In calculus, how is taking $\ln$ on both sides justified? For example, if we want to differentiate $y=x^x,$ we can turn it into $e^{\ln(y)}=y=e^{x\ln(x)},$ seemingly ignore when $x<0,$ differentiate, then convert back. This method can make differentiation (and solving limits) easier, so is obviously important, but I can't find a general proof that justifies it.

EDIT: $x^x$ has domain $\mathbb R^+,$ so the above was a bad example!
Instead, consider $y:\mathbb{R}\to\mathbb{R}.$ If we want to differentiate or take the limit of $y,$ can we take $\ln$ of $y$ without considering when $y\le0$ for $x\in\mathbb{R}\:?$ Then, differentiate or take the limit of $\ln y$ with respect to $x,$ then solve the equation for $\frac{\mathrm dy}{\mathrm dx}$ or $y$ and get the answer?
I'm guessing that since the domain was never explicitly stated, I missed that $y>0$ for $\ln y.$
So, if $x\in\mathbb{R}$ and we change $y=x$ to $\ln y=\ln x,$ we let $x=-x$ for $x<0,$ right?
 A: When performing logarithmic differentiation, texts frequently pretend that the function being taken logarithm of is positive then subsequently hand-wave away that restriction.

Consider $y:\mathbb{R}\to\mathbb{R}$. If we want to differentiate
$y,$ can we take $\ln$ of $y$ without considering when $y\le0$ for
$x\in\mathbb{R}\:?$
I'm guessing that since the domain was never explicitly stated, I
missed that $y>0$ for $\ln y.$
So, if $x\in\mathbb{R}$ and we change $y=x$ to $\ln y=\ln x,$ we let
$x=-x$ for $x<0,$ right?

No; no; no.

How is taking $\ln$ of both sides in calculus justified?

By considering only nonzero values of the function, and taking absolute value before taking $\ln.$
Here's a rigorous presentation of using logarithmic differentiation to determine $f'(x)$ for an identically nonzero $f:$ \begin{align}\text{Let }y=f(x); \text{then }\ln|y|&=\ln|f(x)|\\&=\text{<apply logarithmic identities>}\\\frac{\mathrm dy}{\mathrm dx}\left(\frac1y\right)&=\text{<differentiate the above using $\frac{\mathrm d}{\mathrm dx}\ln|h(x)|=\frac{h’(x)}{h(x)}$>}\\&\ldots\end{align}
(justification of $\frac{\mathrm d}{\mathrm dx}\ln|h(x)|=\frac{h’(x)}{h(x)}$).
As suggested above, this technique has a drawback: it does not apply wherever $f(x)=0$.

Addendum

Ok so if I'm getting this right, if $f(\alpha)=0,$ we can not make any conclusion about $f'(\alpha).$

Yes; for example, logarithmic differentiation by itself gives this result: $$x\ne0\implies \frac{\mathrm d(x^3)}{\mathrm dx}=3x^2.$$
A: This proof is from the function and inversed function:
Let $f(x)=e^x$ and we have inversed function $f^{-1}(x)=\ln(x)$
$$f(f^{-1}(x))=x \Rightarrow e^{\ln(x)}=x$$
$$f^{-1}(f(x))=x \Rightarrow \ln(e^{x})=x$$
A: The function $y = x^x$ does not have domain equal to $\mathbb{R}$. Its domain is in fact $D = (0, +\infty)$ which makes the rewrite of $y$ as $e^{xlnx}$ coherent.
$y = e^{lnx^x}$ is just the definition of logarithm
A: Taking logarithms or exponentials of both sides of an equation is justified because $\ln x$ and $e^x$ are monotone, strictly increasing functions, thus the mapping $x=e^y$ and $\ln x=y$ is bijective and hence unambiguous.
