One way to transform the first sum is to start by writing $\log\prod_{i}^n\frac{x_i}{y_i}$. Now on first view this seems no help because if some $x_i$ or $y_i$ goes to $0$, you still get an invalid expression. However one thing one immediately notices is that if only some $x_i$ or only some $y_i$ goes to $0$, then you're out of luck; there's no way to rewrite the expression so that this will get defined. However if it is guaranteed that whenever some $x_i$ goes to $0$ also some $y_j$ goes to $0$ (where not necessarily $j=i$, that's the advantage of the product form), there may be hope: In that case, you might be able to reformulate the quantities as $x_i = a_{\sigma(i)} \xi_i$ and $y_i = a_{\sigma'(i)} \eta_i$ (with the same a for both, and where $\sigma$ and $\sigma'$ are permutations), so that neither $\xi_i$ nor $\eta_i$ can get $0$ (that is, all zeroes are "captured" by the $a_k$). In that case you can cancel $\prod_k^n a_k$ and simply replace all $x_i$ and $y_i$ by $\xi_i$ and $\eta_i$ (you are then free to use the sum form again if you prefer it). Of course whether that is possible depends on the details of your problem.
For the second sum, resolving the problem is easier: Rewrite $x_i\log\frac{x_i}{\beta}$ as $\log\left(\frac{x_i}{\beta}\right)^{x_i}$ and use the usual convention $0^0=1$. Alternatively you can simply define that in your function $0\log 0=0$.