[logback-user] Appenders

Greg Flex greg.flex at gmail.com
Tue Jun 16 20:20:41 CEST 2009

Hi Ceki,
I have a question about the LoggingEvent object.
I'd like to log some messages by "building" (populating constructor) of
LoggingEvent object, then log it with my appenders.
I saw some sample code on line and what I have at the moment is this:

Logger log;
LoggingEvent event;
Object[] args = {"test", "test2"};  //<-- I'm not sure exactly what this is

event = new LoggingEvent("class", (Logger)

Level.toLevel("DEBUG"), "test message", null, args);

log = (Logger) LoggerFactory.getLogger("testClassName");

This works with my "CONSOLE" appender and I can see messages (with the
passed values) printed.
I have also a "DB" - database appender, to which I'd like to write as well,
but something doesn't work....
I see a couple of "initialization" log messages in the database, (like port
and waiting for clients to connect etc.)
but not the one I'm building myself, even though as I stated above I can see
it in the console.
What am I doing wrong?

Here is part of my config file:


 <appender name="DB" class="ch.qos.logback.classic.db.DBAppender">
      <dataSource class="com.mchange.v2.c3p0.ComboPooledDataSource">

<!-- here I have simple console appender called CONSOLE-->

    <level value ="DEBUG"/>
    <appender-ref ref="CONSOLE" />
    <appender-ref ref="DB" />

I just did a little test and I added an HTML FILE appender. I see all
messages there too, just like in CONSOLE appender case.
but still nothing in the database except for the initialization messages.
Any suggestions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20090616/d1e3b721/attachment.htm>

More information about the Logback-user mailing list