Wowza Community

Silly? How to use getLogger in non-main class?

If you make a separate class but still in the same namespace as the main wowza application how do you get the getLogger() function to work?

For instance I have an Emailer class with a static function SendEmail(x,y,z)

Inside the execution I’d like to be able to send a line to the Wowza log if the email can’t be sent or any other exception. But all I’ve been able to do it use System.out.println().

I figured that this was available via com.wowza.wms.module.*; but no-go. I’ve tried importing all of the com.wowza.wms items and even calling it directly via com.wowza.wms.module.ModuleBase.getLogger() and get:

“The method getLogger() from the type ModuleBase is not visible”

There’s something obvious I’m missing, right?

Thanks.

Do the following:

import com.wowza.wms.logging.*;
// to log
WMSLoggerFactory.getLogger(null).info("log message");

Charlie

Brain fart. I’d just remembered that a minute after posting, and you beat me to it as usual.

Plus for a class that doesn’t already have an import of Application, it can all in-line:

com.wowza.wms.logging.WMSLoggerFactory.getLogger(com.wowza.wms.application.Application.class).info(“In emailer”);

(but I like the null better, didn’[t know that was acceptable)

Thanks Charlie.

-s