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 se...@desjardins.com on 2003/01/24 21:57:12 UTC
Logging multiple strings
I'm thinking of using log4j with the jdbc appender, to log some structured information regarding the usage of my applications. I log with something like:
myLogger.info( userName + applicationName + transactionName );
I would like to be able to use a JDBC conversion pattern that would allow me to load the user name in a column, the application name into another column, and the
transaction name into a third column. But, since the logger only accepts a single string as parameter, there is no way once we get into the layout specification to make a
reference to individual elements. The layout only knows that my string corresponds to the %m specification.
What I would need is the possibility of calling the logger with a collection of strings; then, in the layout, I could reference each string with a %1m , %2m and %3m
specification - something like
... INSERT INTO TEST_TABLE ( userName, transactionName, applicationName ) VALUES ( "%1m" , "%3m", "%2m" ) " .
I know there is no such thing in the package right now, and I don't expect it any time soon, but do you think it would be feasible? And would it be useful, or am I the
only one with that kind of requirements?
Serge Arsenault
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Logging multiple strings
Posted by Daniel Serodio <da...@checkforte.com.br>.
On Fri, 2003-01-24 at 18:57, serge.arsenault@desjardins.com wrote:
> I'm thinking of using log4j with the jdbc appender, to log some structured information regarding the usage of my applications. I log with something like:
>
> myLogger.info( userName + applicationName + transactionName );
>
> I would like to be able to use a JDBC conversion pattern that would allow me to load the user name in a column, the application name into another column, and the
> transaction name into a third column. But, since the logger only accepts a single string as parameter, there is no way once we get into the layout specification to make a
> reference to individual elements. The layout only knows that my string corresponds to the %m specification.
No, the logger accepts a single Object, not String. Wrap username,
appname and transactionname in some king of object, and register an
ObjectRenderer for this custom object.
> What I would need is the possibility of calling the logger with a collection of strings; then, in the layout, I could reference each string with a %1m , %2m and %3m
> specification - something like
> ... INSERT INTO TEST_TABLE ( userName, transactionName, applicationName ) VALUES ( "%1m" , "%3m", "%2m" ) " .
>
> I know there is no such thing in the package right now, and I don't expect it any time soon, but do you think it would be feasible? And would it be useful, or am I the
> only one with that kind of requirements?
>
> Serge Arsenault
--
Daniel Serodio <da...@checkforte.com.br>
CheckForte
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Logging multiple strings
Posted by sk k <sk...@yahoo.com>.
I will also need such a jdbc appender since we have to
audit req/response messages along with certian user
info into a database.
It would be great if such a pattern mechansim is added
so that it will be easy to retieve the values and
store them into a database.
--- serge.arsenault@desjardins.com wrote:
>
> I'm thinking of using log4j with the jdbc appender,
> to log some structured information regarding the
> usage of my applications. I log with something like:
>
> myLogger.info( userName + applicationName +
> transactionName );
>
> I would like to be able to use a JDBC conversion
> pattern that would allow me to load the user name in
> a column, the application name into another column,
> and the
> transaction name into a third column. But, since the
> logger only accepts a single string as parameter,
> there is no way once we get into the layout
> specification to make a
> reference to individual elements. The layout only
> knows that my string corresponds to the %m
> specification.
>
> What I would need is the possibility of calling the
> logger with a collection of strings; then, in the
> layout, I could reference each string with a %1m ,
> %2m and %3m
> specification - something like
> ... INSERT INTO TEST_TABLE ( userName,
> transactionName, applicationName ) VALUES ( "%1m" ,
> "%3m", "%2m" ) " .
>
> I know there is no such thing in the package right
> now, and I don't expect it any time soon, but do you
> think it would be feasible? And would it be useful,
> or am I the
> only one with that kind of requirements?
>
> Serge Arsenault
>
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org