Re: Issues with bridge API while migrating to log4j 2

"Piotr P. Karwasz" <[email protected]>
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <CAFmygFaC8PeXFCTAm1GvPePam6UzTDoqM8tK23si=0Pw1P7mJA@mail.gmail.com>
Hello Pavithra,

The class "org.apache.log4j.rolling.RollingFileAppender" is not part
of the `log4j` artifact, but it is part of `apache-log4j-extras`
(https://mvnrepository.com/artifact/log4j/apache-log4j-extras/1.2.17).

Can you try your original configuration:

On Mon, Feb 21, 2022 at 11:16 AM Kudethur, Pavithra (Enterprise)
<[email protected]> wrote:
> <appender name="FILE" class="org.apache.log4j.rolling.RollingFileAppender">
>         <param name="Append" value="true"/>
>         <rollingPolicy class="org.apache.log4j.rolling.FixedWindowRollingPolicy">
>             <param name="FileNamePattern" value="${app.home.dir}/logs/app.log.%i"/>
>             <param name="ActiveFileName" value="${app.home.dir}/logs/app.log"/>
>             <param name="MaxIndex" value="13" />
>         </rollingPolicy>
>         <triggeringPolicy class="org.apache.log4j.rolling.SizeBasedTriggeringPolicy">
>             <param name="maxFileSize" value="3145728" />
>         </triggeringPolicy>
>         <layout class="org.apache.log4j.PatternLayout">
>             <param name="ConversionPattern" value="%d %-5p [%t] [%X{logCorId}] %c - %m%n"/>
>         </layout>
>     </appender>

using the 2.17.2-SNAPSHOT release of `log4j-1.2-api`, `log4j-core` and
`log4j-api`  *and* the 1.2.17 release of `apache-log4j-extras`? I
tested locally and it worked.

The problem with the configuration above is that under the hood it
will use the original `org.apache.log4j.rolling.RollingFileAppender`
class instead of the more powerful
Log4j 2.x `org.apache.logging.log4j.core.appender.RollingFileAppender`
class. To use the latter you need to switch to a Log4j 2.x
configuration file.

>Issue1: But roll over file name is just having app<Date>.log while we want  filename as app.log, app.log.1, app.log.2…

This was a bug in 2.17.1.

Regards,
Piotr
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.