Test if a function is $L^2$ I know the easiest way to tell if a function is $L^2$ or not is just by integrating its square to see if the integral is finite or not. I am just wondering if this can be seen directly from its duality.
The formal question is the following:
If a function $f$ with the property, $\forall \phi \in L^2$, $f\phi \in L^1$, is $f \in L^2$?
 A: As commented, this is true under some restriction on the measure space. It's false in general: Say $X=\{0\}$, every subset of $X$ is measurable, and $\mu(X)=\infty$. Let $f=1$. Then $f\notin L^2$. But if $\phi\in L^2$ then $\phi=0$, hence $f\phi\in L^1$.
Thanks to @LorenzoQuarisa for pointing out that my first answer was nonsense. I'm going to explain how I got it wrong, partly because if I write it down I may be less likely to make the same error again, and partly to perhaps help prevent someone else from making the same error.
I reasoned as follows: If $H$ is a Hilbert space then $H^*=H$. Hence $(L^2)^*=L^2$  for any measure. Now the condition on $f$ in the question implies that $f\in (L^2)^*$, hence $f\in L^2$.
Sounds right, right? The problem is that of course $(L^2)^*=L^2$ cannot be literally true, since a measurable function is  not a linear functional. We need to be careful about what it actually means.
If $f$ is a measurable function such that $\phi f\in L^1$ for every $\phi\in L^1$, define $\Lambda_f:L^2\to  \Bbb C$ by $$\Lambda _f \phi=\int f\phi.$$ Now "$(L^2)^*=L^2$" is true in this sense:


True Fact. In any measure space the map $f\mapsto \Lambda_f$ gives a  bijective isometry between $L^2$ and $(L^2)^*$.


But that does not show that in general we cannot have $\Lambda_f\in(L^2)^*$ for $f\notin L^2$. Indeed in the above example $f\notin L^2$ but $\Lambda_f=0\in(L^2)^*$.
To put it all another way: When talking about duality in function spaces we tend to identify $f$ and $\Lambda_f$. The example above shows that that's dangerous in a general measure space; we have $\Lambda_f=0=\Lambda_0$ although $f\ne0$. The point to putting it this way is to give a concise explanation of why the problem doesn't arise in a $\sigma$-finite or just semifinite space: In that case $\Lambda_f=0$ implies $f=0$ almost everywhere.
Details, in answer to a question: 


Prop. In a $\sigma$-finite measure space, if $f$ is measurable and $f\phi\in L^1$ for every $\phi\in L^2$ then $f\in L^2$.


Two proofs. The sceond proof is by brute force, including all the details; hence in the first "slick" proof I feel free to leave a few details to you.
Slick proof: Suppose $\f\phi\in L^1$ for every $\phi\in L^2$. Define $T:L^2\to L^1$ by $T\phi=\phi f$. The Closed Graph Theorem shows that $T$ is bounded: First, wlog $f\ne0$ everywhere. Say $\\phi_n\to\phi$ in $L^2$ and $f\phi_n\to g$ in $L^1$. Passing to subsequences, wlog $\phi_n\to\phi$ almost everywhere and $f\phi_n\to g$ almost everywhere; hence $g=f\phi$.
So $T$ is bounded, hence the $\Lambda_f$ defined above is bounded. So there exists $g\in L^2$ with $\Lambda_f=\Lambda_g$, and (easy exercise) since $\mu$ is $\sigma$-finite this shows that $f=g$.
Brute force proof, the advantage being that we know we're not being led astray by the sort of subteties discussed above:


Lemma. If $a_n\in[0,\infty)$ for $n\in\Bbb Z$ and $\sum a_n^2=\infty$ then there exist $b_n\in[0,\infty)$ with $\sum b_n^2<\infty$ and $\sum a_n b_n=\infty$.


Proof: First, if $a_n$ is unbounded, say $a_{n_k}\ge k$. Define $b_{n_k}=1/k$, $b_n=0$ if $n\ne n_k$.
Now assume $a_n$ is bounded; wlog $0\le a_n\le 1$. There exist disjoint sets $E_k\subset\Bbb Z$ with $1\le\sum_{n\in E_k}a_n^2<2.$ Let $b_n=a_n/k$ for $n\in E_k$, $b_n=0$ for $n\notin\bigcup_k E_k$. Then $\sum_{n\in E_k}b_n^2<2/k^2$ and $\sum_{n\in E_k}a_nb_n\ge 1/k$.
Now to prove the Proposition: Wlog $f\ge0$. Assume $f\notin L^2$. For $n\in\Bbb Z$ let $$E_n=\{2^n\le f(x)<2^{n+1}\}.$$Then $$\sum 4^n\mu(E_n)=\infty.$$Since our measure space is $\sigma$-finite there exists $F_n\subset E_n$ with $\mu(F_n)<\infty$ and $$\sum 4^n\mu(F_n)=\infty.$$ Let $a_n=2^n(\mu(F_n))^{1/2}$. Choose $b_n\ge0$ with $\sum b_n^2<\infty$ and $\sum a_nb_n=\infty$. Choose $\beta_n\ge0$ with $$b_n=\beta_n(\mu(F_n))^{1/2}.$$Define $\phi(x)=\beta_n$ for $x\in F_n$, $\phi(x)=0$ otherwise. Then $$\int_{F_n}\phi^2=b_n^2$$ so $\phi\in L^2$, while $$\int_{F_n}\phi f\ge a_nb_n,$$so $\phi f\notin L^1$.
At least I hope so; if that's not quite right I know you can construct $\phi$ in a similar "just do it" manner, setting the value of $\phi$ to the appropriate constant on $\{f\sim 2^n\}$.
Edit: Oops. What I say above about there existing $F_n\subset E_n$ such that etc is not so, for example if $\mu(E_0)=\infty$ and $\mu(E_n)=0$ for $n\ne0$.
Fix: If $\mu(E_n)<\infty$ for every $n$ let $F_n=E_n$ and what's above works. 
If there exists $n$ with $\mu(E_n)=\infty$: Wlog $\mu(E_0)=\infty$. Since $\mu$ is $\sigma$_finite there exist disjoint sets $A_n\subset E_0$ with $0<\mu(A_n)<\infty$ and $\sum\mu(A_n)=\infty$. More or less as before, let $a_n=(\mu(A_n))^{1/2}$; choose $b_n$ with $\sum b_n^2<\infty$ and $\sum a_nb_n=\infty$, let $b_n=\beta_n(\mu(A_n))^{1/2}$, and set $\phi=\beta_n$ on $A_n$, $\phi=0$ elsewhere. Then $\int_{A_n}\phi^2=b_n^2$ so $\phi\in L^2$, while $\int_{A_n}\phi f\ge\int_{A_n}\phi=a_n b_n$, so $f\phi\notin L^1$.
That's not cool like some slick functional analysis thing, but I kind of like that sort of argument for this sort of result, because one could argue that it makes it obvious: If $f\notin L^2$ just look carefully at the size of the sets where $f$ has a certain size, and adjust the value of $\phi$ on those sets just right, and you get $\phi\in L^2$ and $f\phi\notin L^1$.
A: Here is an outline of what you can do:
1) If $f \phi \in L^1$ for all $\phi \in L^2$ and $$E_k = \left\{ \phi \in L^2 : \|f\phi\|_1 \le k \|\phi\|_2\right\}$$ then $L^2 = \bigcup_{k=1}^\infty E_k$. Once you show that each $E_k$ is closed, either the Baire Category Theorem or some variant thereof tells you that at least one $E_k$ contains an interior point.  Thus there exist a natural number $k$, a function $\phi_0 \in L^2$, and a number $\epsilon > 0$ with the property that $$\|\phi - \phi_0\|_2 < \epsilon \implies \|f\phi\|_1 \le k \|\phi\|_2.$$
From here is isn't hard to find a constant $C$ (depending on $k$, $\phi_0$, and $\epsilon$) such that
$$ \sup_{\|\phi\|_2 = 1} \|f \phi\|_1 \le C.$$
2) If $(X,\mu)$ is a $\sigma$-finite measure space and there happens to exist $C \ge 0$ with the property that $$\sup_{\| \phi \|_2 = 1} \int_X |f \phi| \, d\mu \le C$$
for all $\phi \in L^2(X,\mu)$, then $f \in L^2(X,\mu)$ and $\|f\|_2 \le C$. This can be  proved by selecting $\phi$ to be an appropriate truncation of $f$ and applying a suitable limit process.
