[
https://issues.apache.org/jira/browse/LOG4J2-1255?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15102236#comment-15102236
]
Gary Gregory edited comment on LOG4J2-1255 at 1/15/16 8:16 PM:
---------------------------------------------------------------
I had to roll an alternative flow logging API for a JDBC driver last year.
Here is an example of implementing a JDBC API:
{code:java}
@Override
public ResultSet getAttributes(final String catalog, final String
schemaPattern, final String typeNamePattern, final String attributeNamePattern)
throws SQLException {
final String method = traceEntry("getAttributes(catalog=%s,
schemaPattern=%s, typeNamePattern=%s, attributeNamePattern=%s)", catalog,
schemaPattern,
typeNamePattern, attributeNamePattern);
final ResultSet result = ...
return traceExit(method, result);
}
{code}
A common superclass we use for most JDBC API classes defines:
{code:java}
traceEntry(String)
traceEntry(String, Object)
traceEntry(String, Object, int[])
traceEntry(String, Object, Object)
traceEntry(String, Object, Object, Object)
traceEntry(String, Object, String[])
traceEntry(String, Object...)
traceExit(String)
traceExit(String, T)
{code}
The onus is on the developer to create a proper message template and pass
objects appropriate for logging (not passwords for example).
was (Author: garydgregory):
I had to roll an alternative flow logging API for a JDBC driver last year. I'll
put some notes here later today. What we have in Log4j is too basic IMO for
production quality flow logging. TBC... :-)
> Logger.entry and Logger.exit should support Messages.
> -----------------------------------------------------
>
> Key: LOG4J2-1255
> URL: https://issues.apache.org/jira/browse/LOG4J2-1255
> Project: Log4j 2
> Issue Type: Improvement
> Components: API
> Affects Versions: 2.5
> Reporter: Ralph Goers
> Assignee: Ralph Goers
>
> Logger.entry and Logger.exit currently do not support Message objects. This
> reduces the flexibility of what can be logged on entry and exit to methods.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]