You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What happened: The class context of the logger is lost when supplying a custom implementation of gov.nist.core.StackLogger, because gov.nist.core.CommonLogger variable 'name' is never passed to the logger.
What you expected to happen: The NIST stack logs include the name of the logger
Example
Time [Thread-name] DEBUG gov.nist.javax.sip.stack.SIPDialog - isBackToBackUserAgent = false
and not
Time [Thread-name] DEBUG - isBackToBackUserAgent = false
How to reproduce it (as minimally and precisely as possible):
Provide an implementation of gov.nist.core.StackLogger using a Logger such as Log4j2 and set property gov.nist.javax.sip.STACK_LOGGER to MyCustomStackLogger.class.getName()
Anything else we need to know?:
Note that gov.nist.core.CommonLogger will create a new CommonLogger instance with the name of the logging class but the name is never used and CommonLogger adds no value.
Environment:
All Environments
The text was updated successfully, but these errors were encountered:
I would like to be added as a contributor, github profile gidxl03. I have a working solution
minimal code change
backwards compatible
requires jain-sip-ri POM change from Java 1.7 (EOL) to 1.8 to avail of default interfaces
Add default interface method
public interface StackLogger extends LogLevels {
/**
* Invoked on first usage of the logger
* @param clazz
* @return instance of the stack logger for the given class
*/
default StackLogger getLoggerInstance(Class<?> clazz) {return this;}
Modify existing method in StackLogger
public static StackLogger getLogger(Class<?> clazz) {
if (useLegacyLogger && legacyLogger != null) {
return legacyLogger.getLoggerInstance(clazz);
}
return getLogger(clazz.getName());
}
Rejected Solution
Application creates ‘gov.nist.core.CommonLoggerLog4j’ with a custom implementation and loads it first in the classpath
/kind feature
What happened: The class context of the logger is lost when supplying a custom implementation of
gov.nist.core.StackLogger
, becausegov.nist.core.CommonLogger
variable 'name' is never passed to the logger.What you expected to happen: The NIST stack logs include the name of the logger
Example
How to reproduce it (as minimally and precisely as possible):
Provide an implementation of gov.nist.core.StackLogger using a Logger such as Log4j2 and set property
gov.nist.javax.sip.STACK_LOGGER
to MyCustomStackLogger.class.getName()Anything else we need to know?:
Note that gov.nist.core.CommonLogger will create a new CommonLogger instance with the name of the logging class but the name is never used and CommonLogger adds no value.
Environment:
All Environments
The text was updated successfully, but these errors were encountered: