I’m not certain I fully understand what you have set up, but at first glance it does seem as though you’re confusing appenders and logging categories.
When you call logbox.getLogger(“foobar”), foobar is the name of a logging category, not the name of an appender. Remember that loggers (or logger categories) can have any number of appenders assigned to them. Now, I suppose there’s nothing keeping you from also creating an appender called foobar and assigning it to the foobar logger, but that just sounds confusing.
So to try and answer your questions:
“How do I have the name of the component show up in the logged message?”
You will either need to allow LogBox to automatically create named loggers for you with logbox.getLogger(this) which uses the metadata of the component OR you will have to manually include that name in the log text yourself.
“I want send an email using the appender, only at specific times…”
I think the crux of the issue might be that you are crossing your concerns. The code generating the log message should not know or care what kind of appender will be used if any at all. The only information your code is aware of is the log severity and the message itself. Once that is passed off to the logger, LogBox will make a determination about what appenders are assigned to that logger based on its category name. If there is no explicit assignment it climbs the dot-delimited hierarchy until it reaches the root logger. If your code knows that it specifically wants an E-mail to be sent, you might need to be looking at the EmailService instead.
If that doesn’t help you, I’ll need more information about what you’re trying to accomplish.
Thanks!
~Brad
ColdBox Platform Evangelist
Ortus Solutions, Corp
E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com