Binh
Binh

Reputation: 99

Log4j file location when running install4j created executable

I have a GUI that I package into a Window exe using install4j. In my GUI code, I used log4j2, specifying SYSTEM_OUT for STDOUT. However, when I run the exe in Window, I do not see any logging. I understand that the exe is not running in a console, but I don't understand how I can configure it to do what I want.

I tried to redirect stdout and stderr to a file, but that file is not created.

I know my log4j configuration works, because my GUI can run under JavaWebStart with no problem.

Upvotes: 1

Views: 432

Answers (1)

Ingo Kegel
Ingo Kegel

Reputation: 48070

The redirection of stdout and stderr will not interfere with log4j or any other logging system unless you only log to the console.

In the log4j configuration, You have to configure an appender that logs to a writable file. If you install to the program files folder, the file cannot be in the installation directory because you will likely not have elevated privileges when running your application. Log to some folder in %APPDATA% instead.

Upvotes: 1

Related Questions