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

**URL:** <https://community.wowza.com/t/silly-how-to-use-getlogger-in-non-main-class/141>\
**Category:** Wowza Streaming Engine\
**Created:** [November 26, 2007, 6:31pm UTC](https://community.wowza.com/t/silly-how-to-use-getlogger-in-non-main-class/141 "2007-11-26T18:31:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/system/32/447_2.png) [@system](https://community.wowza.com/u/system)\
**Post date:** [November 26, 2007, 6:31pm UTC](https://community.wowza.com/t/silly-how-to-use-getlogger-in-non-main-class/141/1 "2007-11-26T18:31:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [November 26, 2007, 10:39am UTC](https://community.wowza.com/t/silly-how-to-use-getlogger-in-non-main-class/141/2 "2007-11-26T10:39:29Z")

</div>

Do the following:

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

```

Charlie

---

<div class="post-metadata">

**Author:** ![Robert\_Smith](https://avatars.discourse-cdn.com/v4/letter/r/a183cd/32.png) [@Robert\_Smith](https://community.wowza.com/u/Robert_Smith)\
**Post date:** [November 26, 2007, 6:49pm UTC](https://community.wowza.com/t/silly-how-to-use-getlogger-in-non-main-class/141/3 "2007-11-26T18:49:31Z")

</div>

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
