Hello.  I�m a fairly new user and have over the last 6 months been using a
RollingFileAppender.  Works fine but I�ve run across some problems with
having a version of the log4j.properties file on my development system
(Windows) and one on the production (Linux).

Anyway, I�m trying to eliminate those problems by logging to a mySQL
database.  I�ve scoured the Internet and various �tutorials� on getting it
setup, but I�m still running into problems.

I connect to the database already in my Struts application and the logging
is working great.  When I use the same parameters in the log4j.properties
file, I get an error that it can�t connect to the database.  Here�s my
properties file:

# ----------- START --------------

# Root Logger
log4j.rootLogger=info, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=c:\\rootlogger.log
log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=5
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

# Site Logger
Log4j.logger.org.mycompany = debug, orgco

Log4j.appender.orgco=org.apache.log4j.jdbc.JDBCAppender
Log4j.appender.orgco.URL=jdbc:mysql://localhost:3306/logs?autoReconnect=true
Log4j.appender.orgco.Driver=com.mysql.jdbc.Driver
Log4j.appender.orgco.User=couser
Log4j.appender.orgco.Password=password
Log4j.appender.orgco.Sql=INSERT INTO mylog (level) VALUES (�%5p�)         
 [this will change, of course :)]

Log4j.appender.orgco.layout=org.apache.log4j.PatternLayout

# --------------- END ------------------

The following is the error I get:

Log4j: ERROR Failed to excute sql
Java.sql.SQLException: Server connection failure during transaction.  Due
to underlying exception: �java.sql.SQLException: Access denied for user
[EMAIL PROTECTED] to database �logs�

Then it goes on to show the dump.

Anyone know why this is?  I use the exact same driver, username, password,
url, etc. to connect in my webapp.  I am surprised I�m getting this error.

I�ve seen some stuff where you have to have root access to the database, I
think, but I won�t have that on my host.  Ideally, I�d like to be using
the database since the rolling files work great except that I have to keep
one version for production and one for development and there have been
times that the development one snuck into production and caused problems.

Anyway, sorry for the long post�just trying to get this thing to work.

Wes



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to