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=38617>.
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=38617

           Summary: Support for custom levels without specifying classname
           Product: Log4j
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Configurator
        AssignedTo: log4j-dev@logging.apache.org
        ReportedBy: [EMAIL PROTECTED]


Hereby I request that custom levels are supported without the need to specify
the classname.

Currently, the configurators allow the standard levels (such as INFO, ERROR and
FATAL) to be specified without specifying a class name. For example, in a
properties file:

   log4j.rootLogger=DEBUG, console

However, custom levels are only supported if they are referred to by name and
classname, separated by a hash. For example:

   log4j.rootLogger=NOTICE#com.company.log.LogLevel, console

I propose the following alternative is supported:

   log4j.rootLogger=NOTICE, console

Currently, configurators use Level.toLevel(String,Level) class method to convert
the level string to a Level object. The current implementation (in 1.2.13) is as
follows:

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

Proposed implementation scenario:
- use an internal Map to convert from String to Level, in the Level class
- add an entry to this Map each time a Level instance is constructed, with the
appropriate name as the key and the object as the value

-- 
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to