This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

JDBCAppender Log4j Help!

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy all,
I'm trying to use the JDBCAppender that is supplied by the Log4j package to collect log entries in a db (naturally). However, I haven't come across a good example of the log4j.xml that shows what I need to create an appender of the JDBC variety. Everything looks right but since nothing seems to be happening I'm assuming that I've messed something up.
here's the appender snippet I'm using:
<appender name="JDBC" class="org.apache.log4j.jdbc.JDBCAppender">


<param name="url" value="jdbc:mysql://localhost/logs" />
<param name="user" value="test" />
<param name="password" value="test" />

<param name="sql" value="INSERT INTO LOG (log_dt, log_level, msg) VALUES ('test', 'test', 'test')" />
<param name="driver" value="com.mysql.jdbc.Driver" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%m" />
</layout>
</appender>
I then have the category entry as follows:
<category name="com.myclasses">
<priority value="DEBUG" />
<appender-ref ref="JDBC" />
</category>
Nothing is getting inserted into the database, but I can't find any errors in the server logs. I'm using Log4j 1.2.7 with JBoss.
Any ideas?
Thanks,
Tripp
 
There are no more "hours", it's centi-days. They say it's better, but this tiny ad says it's stupid:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!