2

I have a web service Jax-RS running in Weblogic. I have a need to logg the calls made to the service.

What is the best way to log to SQL Server from a java application?

Thanks.

John
  • 1,852
  • 4
  • 26
  • 49

2 Answers2

2

Since you're asking for the best way, and if Log4J is not a strong requirement, my suggestion would be to use Logback and its DbAppender. That's the best way :)

Last time I checked, the JDBCAppender from Log4J was still not satisfying and if you can't use logback, you might prefer some third party implementation. See the links below for details:

Pascal Thivent
  • 562,542
  • 136
  • 1,062
  • 1,124
  • Can logback be dynamically turned on and off once the app is live? – John Sep 23 '10 at 13:56
  • @John Yes, logback can be configured to [reload](http://logback.qos.ch/manual/configuration.html#autoScan) its configuration. You can also configure it at runtime via [JMX](http://logback.qos.ch/manual/jmxConfig.html). – Pascal Thivent Sep 23 '10 at 14:03
0

This question was asked in a very simlilar fashion a little while ago.
See here for the original: Log to a database using log4j

The accepted answer points to the DBAppender by logback. http://logback.qos.ch/manual/appenders.html#DBAppender

Community
  • 1
  • 1
fgysin
  • 11,329
  • 13
  • 61
  • 94