Re: Problem converting from Log4j to Log4j2 (log files not being created)

"Piotr P. Karwasz" <[email protected]> Tue, 7 Jan 2025 16:26:57 +0100
Newsgroups gmane.comp.jakarta.log4j.user
Message-ID <[email protected]>
--------------43XUA0OlI3sxCczxZiU0OLvy
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Steven,

I was just looking at your StackOverflow question[1], but it will 
probably be easier to answer here.

[1] 
https://stackoverflow.com/questions/79334046/problem-converting-from-log4j-to-log4j2-log-files-not-being-created

On 7.01.2025 15:41, Nelligan, Steven M wrote:
> I am trying to convert a tomcat app from log4j to log4j2. The app is still written in Java 7 so I am using log4j2 version 2.12.1.

Is it also deployed on JRE 7 (unsupported since July 2022)?

If you are using JRE 8 or later at runtime, you can package Log4j 2.24.3 
in your application.

Note: You should at least update to the last patch release (2.12.4) that 
contains important security fixes.

> 2025-01-06 12:08:38,784 localhost-startStop-5 DEBUG FileAppender$Builder(fileName="g:\tomcat\logs\account-request.log", append="null", locking="null", advertise="null", advertiseUri="null", createOnDemand="null", filePermissions="null", fileOwner="null", fileGroup="null", bufferedIo="null", bufferSize="null", immediateFlush="null", ignoreExceptions="null", PatternLayout(%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n), name="File", Configuration(G:\Tomcat7\temp\51-accountrequest\WEB-INF\classes\log4j2.xml), Filter=null, ={})
> 2025-01-06 12:08:38,800 localhost-startStop-5 DEBUG Starting FileManager g:\tomcat\logs\account-request.log

I don't remember exactly how 2.12.x worked, but these lines indicate 
that the file is created. Maybe:

* The file is deleted by some other process afterwards?

* The Windows VirtualStore[2] comes also to mind, which stores the files 
created by legacy applications in 
%UserProfile%\AppData\Local\VirtualStore. I am not sure if that is the 
case of JRE 7.

Piotr

[2] 
https://www.reddit.com/r/Windows10/comments/5fe3a5/what_is_virtual_store/

--------------43XUA0OlI3sxCczxZiU0OLvy--