1

I want to write logging-messages to a defined file into the tomcat's log-folder, using eclipse, maven, tinylog.

Problem: There is no webapp.log as soon as I run the app in tomcat. In eclipse everything works fine.

What I did:

  • add Maven-dependency tinylog-1.2.jar
  • set configuration-parameter in Run Configuration (Main-Tab) so the tinylog-properties can be found for the build-process: name: -Dtinylog.configuration value: C:\Program Files\Tomcat\apache-tomcat-9.0.0.M13\webapps\folder\subfolder\tinylog.properties
  • in Java-Class: import org.pmw.tinylog.Logger; ... Logger.info(message);

tinylog.properties looks like:

tinylog.writer = file
tinylog.writer.filename = webapp.log
tinylog.writer.buffered = true
tinylog.writer.append = true
tinylog.level = info

I also tried different file-references but none of them worked:

tinylog.writer.file = C:\Program Files\Tomcat\apache-tomcat-9.0.0.M13\logs\webapp.log
tinylog.writer.file= "C:\Program Files\Tomcat\apache-tomcat-9.0.0.M13\logs\webapp.log"

Does anybody know how to write the logs into the named path-file?

Thanks for any valuable hint.

1 Answer 1

0

I propose to use the tinylog-jul artifact instead of the usual tinylog artifact. tinylog-jul provides the tinylog API, but uses the Tomcat logging back end. So, you don't need to configure tinylog. All log entries will be automatically output as you are used to with other logging APIs on Tomcat.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.