Doubt about the domain in logarithmic functions. According to my book, the logarithmic function $$\log_{a}x=y$$  is defined if both $x$ and $a$ are positive and $x\neq 0$  and $a\neq 1$.
So are these not correct?
$$\log_{-3}9=2$$ $$\log_{-2}-8=3$$ 
 A: They are correct in the sense that $(-3)^{2}=9$ and $(-2)^{3}=-8$.  The difficulty arises because you want to think of $\log_{a}(x)$ as the inverse function of $a^{x}$.  If $a>0$ (and $a\neq 1$) then $a^{x}$ is a continuous, real-valued (whenever $x$ is real), injective function (so $\log_{a}(x)$ makes sense).  If $a=1$ then $a^{x}$ is not injective and so it does not have an inverse.  If $a<0$ then you no longer have a real valued function (when $x$ is real).  For example, $(-3)^{1/2}$ where $x=1/2$ is not a real number.  Generally, the restrictions they give ensure that for real inputs (domain) you get real outputs (range)--and the goal is to have the domain be as large as possible.  Also, as pointed out by @graydad, the usual logarithm rules fail if $a<0$.
So the long story short is: you can define logarithms with negative base, but you really don't want to (because nothing works the way you want/expect).
A: The easy argument is that the two equations are incorrect because they violate the definition. The logarithm function permits a base that is strictly positive and not equal to one, and a domain that is strictly positive.
Another way to see that your two examples can lead us to trouble is that you lose two very important properties of the logarithm. Namely,
$$\log_a(xy) = \log_a(x)+\log_a(y) \qquad \text{and} \qquad \log_a\left(x^p\right) = p\log_a(x)$$ To put this into practice, let's start with the first equation you provided, $\log_{-3}(9)=2$. Supposing for the sake of contradiction that that equation is valid, we should also be able to apply the logarithm property $$\log_{-3}(9) = \log_{-3}(3^2) = 2\log_{-3}(3)$$ This means we should find that $\log_{-3}(3)=1$. Yet clearly it is not true that $(-3)^1 = 3$, so $\log_{-3}(3)=1$ is an invalid equation, meaning we have the following contradiction: $$2\log_{-3}(3) \neq 2 = \log_{-3}(9)= 2\log_{-3}(3)$$ At this point we can either choose to allow negative values of $a$ (which if we do will almost assuredly mean the logarithm will produce complex numbers), or choose to keep the logarithm property $\log_a\left(x^p\right) = p\log_a(x)$. But we cannot have both. You can derive a similar contradiction with your second equation as well. Ultimately it is much more beneficial to keep $a$ positive and not equal to one than it is to lose those nice logarithm properties. The same can be said for allowing negative arguments in the logarithm. This is all from the perspective that you are working with real numbers, as things must be handled differently with complex numbers.
A: Absolutely not. What would then be $\log _{-3} 7$?
A: In the real numbers the domain of the logarithm function ehich is defined as:
$a^{x}=b$ implies, $x=\log_{a}(b)$.
If we are talking about the real numbers, the domain of the the logarithm function is:
$x\in[-\infty,\infty]$
$b\in[1,\infty]$
$a\in[2,\infty$]
In the complex numbers the only thing that changes is the domain of $b$ it extends to $b<0$ and to numbers, $b$ s.t. $Im(b)\neq0$.
The first one is right although the second one:
$log_{2}(-8)=3$
Is not, it is actually in the complex numbers. For the future, 
$log_{2}(-8)=\frac{(log(8)+i\pi)}{log(2)}$
Hope this helps, 
Aleksandar
