[QFJ-983] SLF4JLog is suffixing category with session ID instead of prefixing it. Created: 10/Aug/19  Updated: 29/Nov/19  Resolved: 29/Nov/19

Status: Closed
Project: QuickFIX/J
Component/s: Engine
Affects Version/s: 2.1.1
Fix Version/s: 2.2.0

Type: Bug Priority: Minor
Reporter: Simon Ogbamichael Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: slf4jlog
Environment:

N/A



 Description   

The property SLF4JLogPrependSessionID "Controls whether session ID is prepended to log message." This property is passed down to SLF4J and used in the method quickfix.SLF4JLog#getLogger.

Based on the property name and description, one would think that the Session ID will appear as prefix of category. But the method getLogger suffixes category with session ID instead of prefixing it. I think this is a bug.

Bug:

private Logger getLogger(SessionID sessionID, String category, String defaultCategory, String logPrefix) {
    return LoggerFactory.getLogger((category != null
            ? substituteVariables(sessionID, category)
            : defaultCategory) + logPrefix);
}

Proposed Fix:

private Logger getLogger(SessionID sessionID, String category, String defaultCategory, String logPrefix) {
    return LoggerFactory.getLogger(logPrefix + (category != null
            ? substituteVariables(sessionID, category)
            : defaultCategory));
}

Thanks!



 Comments   
Comment by Christoph John [ 12/Aug/19 ]

Hi Simon Ogbamichael,

thanks for the issue. This was discussed briefly some weeks ago on the mailing list but never made it into a JIRA issue. If you'd like you can open a pull request with your proposed fix at https://github.com/quickfix-j/quickfixj/pulls

Thanks,
Chris.

Comment by Christoph John [ 12/Aug/19 ]

https://sourceforge.net/p/quickfixj/mailman/message/36714538/

Comment by Christoph John [ 29/Nov/19 ]

This change has been reverted in https://github.com/quickfix-j/quickfixj/pull/234

Generated at Fri May 03 00:06:38 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.