You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by T Master <tm...@iknowledge.com> on 2002/02/11 20:16:08 UTC

compile error upgrading from log4j v1.2 alpha 7 to v1.2 beta 2

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)
    [javac]             myLogger.setLevel(Level.FATAL);

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


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: compile error upgrading from log4j v1.2 alpha 7 to v1.2 beta 2

Posted by T Master <tm...@iknowledge.com>.
FYI: http://jakarta.apache.org/log4j/docs/TROUBLESHOOT.html online does not
appear to have been updated.

Thanks for the casting tip. :o)


----- Original Message -----
From: "Ceki Gülcü" <ce...@qos.ch>
To: "Log4J Users List" <lo...@jakarta.apache.org>
Sent: Monday, February 11, 2002 1:41 PM
Subject: Re: compile error upgrading from log4j v1.2 alpha 7 to v1.2 beta 2


>
> 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.
>
> --
> Ceki Gülcü



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: compile error upgrading from log4j v1.2 alpha 7 to v1.2 beta 2

Posted by Ceki Gülcü <ce...@qos.ch>.
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:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>