You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Andreas Guther <an...@guther.com> on 2004/06/06 17:54:37 UTC

Re: [log4j] JDBCAppender: WHat am I doing wrong?

Frank:

Could id be that the order of appender and logging level plays a role?  
I am not  100% sure but my first guess is to have first the appender 
listed and last the log level, i.e. in your case

log4j.logger.sysadmin.databaselogging = R5, INFO

Andreas

Frank Burns wrote:

>Can anyone please tell me what am I doing wrong?
>
>I'm trying to set up the JDBCAppender but don't get anything logged to the
>database. I can't figure out what's wrong. I've even got Ceki's manual, but
>it's not covered.
>
>Here's part of my config file:
>==============================
>
>##### For sysadmin.databaselogging, assign a logging level of INFO and add a
>JDBCAppender to it #####
>log4j.logger.sysadmin.databaselogging = INFO, R5
>
># JDBC appender
>log4j.appender.R5=org.apache.log4j.jdbc.JDBCAppender
>log4j.appender.R5.BufferSize=4096
>log4j.appender.R5.Driver=com.mysql.jdbc.Driver
>log4j.appender.R5.URL=jdbc:mysql://localhost/mydb
>log4j.appender.R5.user=frank
>log4j.appender.R5.password=banana
>log4j.appender.R5.layout=org.apache.log4j.PatternLayout
>log4j.appender.R5.layout.ConversionPattern=INSERT INTO Logs (Date, Logger,
>Priority, Message) VALUES ('%d', '%c', '%p', '%m')
>log4j.appender.R5.threshold=INFO
>
>Here's the mySQL database table:
>================================
>
>CREATE TABLE Logs(
> Date VARCHAR(255),
> Logger VARCHAR(255),
> Priority VARCHAR(255),
> Message TEXT
> )
> TYPE = InnoDB;
>
>Here's relevant bits of code:
>=============================
> ...
> static Logger databaseLogger =
>Logger.getLogger("sysadmin.databaselogging");
> ...
> databaseLogger.info("System Administrator has just signed on.");
> ...
>
>
>Any ideas?
>
>Thanks,
>
>Frank.
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: [log4j] JDBCAppender: What am I doing wrong?

Posted by Frank Burns <fr...@the-hub.demon.co.uk>.
And the problem was ... log4j.appender.R5.BufferSize=4096

When I remove this, or set it to a much lower value, then I get the
immediate logging output that I expect.

Thanks.

----- Original Message ----- 
From: "Frank Burns" <fr...@the-hub.demon.co.uk>
To: "Log4J Users List" <lo...@logging.apache.org>
Sent: Sunday, June 06, 2004 8:08 PM
Subject: Re: [log4j] JDBCAppender: WHat am I doing wrong?


> Hi Andreas,
>
> Thanks for your interest.
>
> > Could id be, that the order of appender and logging level plays a role?
> They have to be in the order I specified. I changed them and got an error
> saying that there was no appender named "INFO".
> And all of my other appenders are defined this way, and they work
perfectly.
>
> Any other ideas?
>
> Do YOU have a system working with JDBCAppender? Can you tell me how you
have
> configured it?
>
> Thanks,
>
> Frank.
>
> ----- Original Message ----- 
> From: "Andreas Guther" <an...@guther.com>
> To: "Log4J Users List" <lo...@logging.apache.org>
> Sent: Sunday, June 06, 2004 4:54 PM
> Subject: Re: [log4j] JDBCAppender: WHat am I doing wrong?
>
>
> > Frank:
> >
> > Could id be that the order of appender and logging level plays a role?
> > I am not  100% sure but my first guess is to have first the appender
> > listed and last the log level, i.e. in your case
> >
> > log4j.logger.sysadmin.databaselogging = R5, INFO
> >
> > Andreas
> >
> > Frank Burns wrote:
> >
> > >Can anyone please tell me what am I doing wrong?
> > >
> > >I'm trying to set up the JDBCAppender but don't get anything logged to
> the
> > >database. I can't figure out what's wrong. I've even got Ceki's manual,
> but
> > >it's not covered.
> > >
> > >Here's part of my config file:
> > >==============================
> > >
> > >##### For sysadmin.databaselogging, assign a logging level of INFO and
> add a
> > >JDBCAppender to it #####
> > >log4j.logger.sysadmin.databaselogging = INFO, R5
> > >
> > ># JDBC appender
> > >log4j.appender.R5=org.apache.log4j.jdbc.JDBCAppender
> > >log4j.appender.R5.BufferSize=4096
> > >log4j.appender.R5.Driver=com.mysql.jdbc.Driver
> > >log4j.appender.R5.URL=jdbc:mysql://localhost/mydb
> > >log4j.appender.R5.user=frank
> > >log4j.appender.R5.password=banana
> > >log4j.appender.R5.layout=org.apache.log4j.PatternLayout
> > >log4j.appender.R5.layout.ConversionPattern=INSERT INTO Logs (Date,
> Logger,
> > >Priority, Message) VALUES ('%d', '%c', '%p', '%m')
> > >log4j.appender.R5.threshold=INFO
> > >
> > >Here's the mySQL database table:
> > >================================
> > >
> > >CREATE TABLE Logs(
> > > Date VARCHAR(255),
> > > Logger VARCHAR(255),
> > > Priority VARCHAR(255),
> > > Message TEXT
> > > )
> > > TYPE = InnoDB;
> > >
> > >Here's relevant bits of code:
> > >=============================
> > > ...
> > > static Logger databaseLogger =
> > >Logger.getLogger("sysadmin.databaselogging");
> > > ...
> > > databaseLogger.info("System Administrator has just signed on.");
> > > ...
> > >
> > >
> > >Any ideas?
> > >
> > >Thanks,
> > >
> > >Frank.
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > >For additional commands, e-mail: log4j-user-help@logging.apache.org
> > >
> > >
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: [log4j] JDBCAppender: WHat am I doing wrong?

Posted by Frank Burns <fr...@the-hub.demon.co.uk>.
Hi Andreas,

Thanks for your interest.

> Could id be, that the order of appender and logging level plays a role?
They have to be in the order I specified. I changed them and got an error
saying that there was no appender named "INFO".
And all of my other appenders are defined this way, and they work perfectly.

Any other ideas?

Do YOU have a system working with JDBCAppender? Can you tell me how you have
configured it?

Thanks,

Frank.

----- Original Message ----- 
From: "Andreas Guther" <an...@guther.com>
To: "Log4J Users List" <lo...@logging.apache.org>
Sent: Sunday, June 06, 2004 4:54 PM
Subject: Re: [log4j] JDBCAppender: WHat am I doing wrong?


> Frank:
>
> Could id be that the order of appender and logging level plays a role?
> I am not  100% sure but my first guess is to have first the appender
> listed and last the log level, i.e. in your case
>
> log4j.logger.sysadmin.databaselogging = R5, INFO
>
> Andreas
>
> Frank Burns wrote:
>
> >Can anyone please tell me what am I doing wrong?
> >
> >I'm trying to set up the JDBCAppender but don't get anything logged to
the
> >database. I can't figure out what's wrong. I've even got Ceki's manual,
but
> >it's not covered.
> >
> >Here's part of my config file:
> >==============================
> >
> >##### For sysadmin.databaselogging, assign a logging level of INFO and
add a
> >JDBCAppender to it #####
> >log4j.logger.sysadmin.databaselogging = INFO, R5
> >
> ># JDBC appender
> >log4j.appender.R5=org.apache.log4j.jdbc.JDBCAppender
> >log4j.appender.R5.BufferSize=4096
> >log4j.appender.R5.Driver=com.mysql.jdbc.Driver
> >log4j.appender.R5.URL=jdbc:mysql://localhost/mydb
> >log4j.appender.R5.user=frank
> >log4j.appender.R5.password=banana
> >log4j.appender.R5.layout=org.apache.log4j.PatternLayout
> >log4j.appender.R5.layout.ConversionPattern=INSERT INTO Logs (Date,
Logger,
> >Priority, Message) VALUES ('%d', '%c', '%p', '%m')
> >log4j.appender.R5.threshold=INFO
> >
> >Here's the mySQL database table:
> >================================
> >
> >CREATE TABLE Logs(
> > Date VARCHAR(255),
> > Logger VARCHAR(255),
> > Priority VARCHAR(255),
> > Message TEXT
> > )
> > TYPE = InnoDB;
> >
> >Here's relevant bits of code:
> >=============================
> > ...
> > static Logger databaseLogger =
> >Logger.getLogger("sysadmin.databaselogging");
> > ...
> > databaseLogger.info("System Administrator has just signed on.");
> > ...
> >
> >
> >Any ideas?
> >
> >Thanks,
> >
> >Frank.
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> >For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org