logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (LOG4J2-1255) Logger.entry and Logger.exit should support Messages.
Date Fri, 15 Jan 2016 20:17:39 GMT

    [ 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:

    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);

A common superclass we use for most JDBC API classes defines:

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, T)

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

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

View raw message