Home > DeveloperSection > Forums > How to make log4j work with jetty?
JAMES Williams
JAMES Williams

Total Post:7

Posted on    December-14-2015 12:53 AM

 Java Java 

 1 Reply(s)
 590  View(s)
Rate this:
I want to make jetty server log with log4j. When I use IDEA to deploy exploded war it works well. IDEA creates this file (root.xml) in /tmp directory:

<?xml version="1.0"  encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
    <Set name="contextPath">/</Set>
    <Set name="resourceBase">/home/username/Desktop/project/ROOT/target/root</Set>

After I copy this file to /opt/jetty/webapps and restart jetty service it stops logging. I didn't change anything else in the project. I didn't even change the directory, everything is the same.

I just want to deploy without IDEA.

How do I make log4j work with a manually deployed exploded war on Jetty 9 server?

Mayank Tripathi
Mayank Tripathi

Total Post:397

Posted on    December-14-2015 1:20 AM

When you deploy from IDEA, it runs from a privileged user and has write access to the logs.

The server has its own log files and its own user. It might not have proper rights to write the logs that you're checking. So you should check the server's own log files. Maybe you'll find there FileNotFoundException with Permission Denied. You need to give Jetty user rights to edit log files

Don't want to miss updates? Please click the below button!

Follow MindStick