You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2005/10/17 15:45:50 UTC
DO NOT REPLY [Bug 37119] New: -
Space after log level causes default level to be used
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37119>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=37119
Summary: Space after log level causes default level to be used
Product: Log4j
Version: unspecified
Platform: All
OS/Version: other
Status: NEW
Severity: normal
Priority: P4
Component: Appender
AssignedTo: log4j-dev@logging.apache.org
ReportedBy: csisk@decaresystems.ie
For the rootCategory definitions, whitespace characters between the log level
and the comma before log type causes the default log level to be used (DEBUG)
> log4j.rootCategory=INFO , FILE
For the above rootCategory definition, the logger uses DEBUG as default for the
log level. This is because the method "public static Level toLevel(String sArg,
Level defaultLevel)" in the org.apache.log4j.Level class does not trim the level
string.
Therefore from the above definition of rootCatetory the string "INFO " is passed
to the toLevel method. Which does not match any of the criteria in the toLevel
method. A simple trim of the whitespace in the toLevel method would solve this
issue.
/**
Convert the string passed as argument to a level. If the
conversion fails, then this method returns the value of
<code>defaultLevel</code>.
*/
public
static
Level toLevel(String sArg, Level defaultLevel) {
if(sArg == null)
return defaultLevel;
String s = sArg.toUpperCase();
if(s.equals("ALL")) return Level.ALL;
if(s.equals("DEBUG")) return Level.DEBUG;
if(s.equals("INFO")) return Level.INFO;
if(s.equals("WARN")) return Level.WARN;
if(s.equals("ERROR")) return Level.ERROR;
if(s.equals("FATAL")) return Level.FATAL;
if(s.equals("OFF")) return Level.OFF;
if(s.equals("TRACE")) return Level.TRACE;
return defaultLevel;
}
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org