[EMAIL PROTECTED] writes:
>------_=_NextPart_001_01C2EA34.46FADD80
>Content-Type: text/plain;
> charset="iso-8859-1"
>Hi all,
>I am updating an existing app to 2.3. I am getting lots of warnings like:
>The type Log is deprecated in my Actions. What is the replacement? I
>looked for getLogger and such, but no luck. Is it to switch to
>commons-logging or something? If someone can point me in the right
>direction, I'll update the wiki.
You replace e.g.
Log.info("foo");
with
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class yourclass
{
private static Log log = LogFactory.getLog(<logger definition>);
[...]
log.info("foo");
}
The logger definition will decide into which Log4j Logging category your
log will go. For the Turbine internals we use
LogFactory.getLogger(<current class name>.class);
which selects a logger name based on the class (the log4j logs are organized
in a hierarchic manner) and this makes it very easy to put e.g. everything
that starts with org.apache.turbine into one log.
If you have an application, you could use e.g.
LogFactory.getLog("applicationLog");
and put such a definition in the Log4j.properties but I'd recommend
against that and advise that you keep the <xxx>.class approach and
simply configure to put all logging messages from your app into one
log.
I e.g. use
log4j.category.de.intermeta = INFO, application
log4j.additivity.de.intermeta = false
log4j.appender.application = org.apache.log4j.FileAppender
log4j.appender.application.file = ${applicationRoot}/logs/application.log
log4j.appender.application.layout = org.apache.log4j.PatternLayout
log4j.appender.application.layout.conversionPattern = %d [%t] %-5p %c - %m%n
log4j.appender.application.append = false
for my applications.
Regards
Henning
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
[EMAIL PROTECTED] +49 9131 50 654 0 http://www.intermeta.de/
Java, perl, Solaris, Linux, xSP Consulting, Web Services
freelance consultant -- Jakarta Turbine Development -- hero for hire
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]