Hi Sai,

Thank you very much for your assistance.

I finally got it working!!

What made the difference was adding a driver specification to the log4j
appender definition in log4j.properties. I now have:

log4j.appender.S=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.S.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
log4j.appender.S.URL=jdbc:sqlserver://aphrodite;databaseName=MobileFrame;integratedSecurity=true;
log4j.appender.S.layout=org.apache.log4j.PatternLayout
log4j.appender.S.sql=INSERT INTO [dbo].[XW_FTPLOG] (LEVEL, LOG_TIME,
LOGIN, REMOTE_IP, MESSAGE) VALUES ( '%5p', '%d', '%X{userName}', '%
X{remoteIp}', '%m%n' );

Previously, the log4j.appender.S.driver line wasn't there. Why it found
the driver without it when run from the command line but didn't find it
when run as a service I have no idea. But now it is working beautifully.

Now my only problem is log messages with single quotes in them. I
understand other implementations of JDBCAppender deal with that better,
or maybe I can add a filter to log4j to escape them.

Thanks again,
Ian

Reply via email to