Hi Ceki,<br>I have a question about the LoggingEvent object.<br>I'd like to log some messages by "building" (populating constructor) of LoggingEvent object, then log it with my appenders. <br>I saw some sample code on line and what I have at the moment is this:<br>
<br>Logger log;<br>LoggingEvent event;<br>Object[] args = {"test", "test2"}; //<-- I'm not sure exactly what this is for?<br> <br>event = new LoggingEvent("class", (Logger) LoggerFactory.getLogger("SimpleSocketServer"),<br>
Level.toLevel("DEBUG"), "test message", null, args);<br><br>log = (Logger) LoggerFactory.getLogger("testClassName");<br>log.callAppenders(event);<br>
<br>This works with my "CONSOLE" appender and I can see messages (with the passed values) printed.<br>I have also a "DB" - database appender, to which I'd like to write as well, but something doesn't work....<br>
I see a couple of "initialization" log messages in the database, (like port and waiting for clients to connect etc.)<br>but not the one I'm building myself, even though as I stated above I can see it in the console.<br>
What am I doing wrong? <br><br>Here is part of my config file:<br><br><configuration><br> <br> <appender name="DB" class="ch.qos.logback.classic.db.DBAppender"><br> <connectionSource class="ch.qos.logback.core.db.DataSourceConnectionSource"><br>
<dataSource class="com.mchange.v2.c3p0.ComboPooledDataSource"><br> <driverClass>com.mysql.jdbc.Driver</driverClass><br> <jdbcUrl>jdbc:mysql://localhost:3306/logging</jdbcUrl><br>
<user>greg</user><br> <password>greg</password><br> </dataSource><br> </connectionSource><br> </appender><br><br><!-- here I have simple console appender called CONSOLE--><br>
<br> <root><br> <level value ="DEBUG"/><br> <appender-ref ref="CONSOLE" /><br> <appender-ref ref="DB" /><br> </root> <br></configuration><br><br>
<br>UPDATE:<br>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.<br>but still nothing in the database except for the initialization messages. <br>
Any suggestions?<br>Thanks<br>Gregory.<br><br>