Thanks for the suggestion, and it appears to work in most cases.  Now my
problem is this:

We have code on our client that sends logging calls to our server so
that we can include 'client logged errors' in our server log.  When we
log an exception using log.error(throwable) this goes across to the wire
to our server by passing the LoggingEvent as a parameter.  The throwable
gets wrapped in a ThrowableInformation class but the throwable variable
is listed as transient - as a result - when the LoggingEvent gets to my
server, the throwable is null!  

The ThrowableInformation class does have the string representation of
the stack trace in the 'rep' variable - is there any way for me to have
that data 'rendered' as the message???

It seems like I need to capture this on the client side and any
throwable needs to be converted to a string and have that string
rendered somehow???



-----Original Message-----
From: Mattias Andersson [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 19, 2006 5:52 AM
To: Log4J Users List
Subject: Re: JDBCAppender with large message values

Hi,

> Hi,
>
> I want to include the JDBCAppender as one of our appenders so that all
> error level messages will be written to a common database.  The
problem is
> that the message content frequently contains a stack trace which is
too
> large for the database column.  What I get right now is a row with the
> 'message' column empty/null.
>
> I looked at extending JDBCAppender doAppend method, which would check
the
> length of the message and truncate it after the first X bytes but the
> LogEvent doesn't provide getters so that I could create a different
> LogEvent with the truncated message.
>
> What I really want to be able to do is use a format modifier on the
> message column, something like %2048m
> to get the first 2k bytes for the column.
>
> Any suggestions on other ways to get this implemented?
>
Use SUBSTRING in the INSERT statment perhaps?

INSERT INTO LOG_MESSAGES(Message) VALUES(SUBSTRING('%m', 0, 2048))

Regards,
 /Mattias






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


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

Reply via email to