logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: compile error upgrading from log4j v1.2 alpha 7 to v1.2 beta 2
Date Mon, 11 Feb 2002 20:41:07 GMT

T Master,

Subsequent to your query, I added the following entry into the
Troubleshooting guide:

===================================================================
Compilation errors when using setLevel(org.apache.log4j.Level) from
the Category class.
===================================================================

If you are getting complaints such as the following from the compiler,
do not worry there is an easy solution. But first here is the problem
reported by the compiler:

   [javac] setLevel(org.apache.log4j.Level) in org.apache.log4j.Category 
cannot be applied to (org.apache.log4j.Priority)
   [javac]         logger.setLevel(Level.DEBUG);

where logger is a variable of type Logger.

Casting any of the Level.DEBUG, Level.INFO, Level.WARN, Level.ERROR,
Level.FATAL arguments to Level will make the compiler happy. As in

    logger.setLevel((Level) Level.DEBUG);

This cast is always safe because log4j 1.2 will never produce anything
but Level objects, never Priority objects.


At 12:16 11.02.2002 -0700, T Master wrote:

>I have upgrade my log4j.jar to use the v1.2 beta 2  version now.
>
>I now get several compilation errors:
>
>  setLevel(org.apache.log4j.Level) in org.apache.log4j.Category cannot be 
> applied
>to (org.apache.log4j.Priority)
>     +AFs-javac+AF0-             myLogger.setLevel(Level.FATAL)+ADs-
>
>myLogger is of type Logger.
>
>Interestingly, there is no problem when using Level.OFF or 
>Level.ALL  (they are
>defined in the Level class).
>
>I thought this was my own build error, so i cleaned my classes and rebuilt.
>Same thing.
>I repeated with the v1.2 alpha 7 jar, and no problem. I repeat, and no 
>problem.
>I repeat using the beta 2 jar, and the compile error appears again.
>
>I haven't looked at the source code between alpha 7 and beta 2 yet.
>The javadocs do allow the method call though for setLevel(Level) which is
>inherited from Category.
>
>Any tips?
>
>Regards,
>
>T Master

--
Ceki Gülcü



--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message