Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7995161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:19:40+00:00 2026-06-04T14:19:40+00:00

I setup my Java EE 6 application taking as a starting point the log4j

  • 0

I setup my Java EE 6 application taking as a starting point the log4j quickstart in Jboss 7.1.

My key pom.xml additions are:

<dependencyManagement>
        <dependencies>
            <!-- Define Log4j dependency and its version -->
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>${log4j.version}</version>
            </dependency>
...
        </dependencies>
    </dependencyManagement>

<dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <scope>provided</scope>
        </dependency>

Version is 1.2.16.

Now I can do:

private static final Logger logger =
Logger.getLogger(MacchinarioController.class);

and use logger as expected. Good!

I have no log4j.xml nor .properties files.

Now I want Hibernate to print in console all SQL statements being executed, including parameters values.

I created this log4j.xml and put it in src/main/resources source folder:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration>

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

    <appender name="console" class="org.apache.log4j.ConsoleAppender">
        <param name="Threshold" value="info"/>
        <param name="Target" value="System.out"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{ABSOLUTE} [%t] %-5p %c{1} - %m%n"/>
        </layout>
    </appender>

    <appender name="rolling-file" class="org.apache.log4j.RollingFileAppender">
        <param name="file" value="Program-Name.log"/>
        <param name="MaxFileSize" value="1000KB"/>
        <param name="MaxBackupIndex" value="4"/>
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d [%t] %-5p %l - %m%n"/>
        </layout>
    </appender>
    <logger name="org.hibernate">
        <level value="ALL" />
    </logger>

    <root>
        <priority value ="debug" />
        <appender-ref ref="console" />
        <appender-ref ref="rolling-file" />
    </root>
</log4j:configuration>

But nothing shows up, where am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T14:19:41+00:00Added an answer on June 4, 2026 at 2:19 pm

    Are you using the jboss-deployment-structure.xml to exclude the servers version of log4j?

    If you’re starting an application from scratch I definitely wouldn’t choose log4j. I am biased to JBoss Logging, but JBoss Logging, slf4j or logback are far better than log4j.

    By default JBoss AS 7 uses JBoss Logging with the JBoss Log Manager. Though really you would/could just use JBoss Logging as it will work with any of log manager.

    If you do want to use log4j, don’t use the log4j configuration. Add the logger/category to the logging subsystem to see the results you are looking for.

    All that said, in the next release of JBoss AS 7 your log4j configuration would be found and would just work for you the way you expect it to. The changes have been pushed to the upstream.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm following a tutorial to set up a skeleton application for tomcat : http://maestric.com/doc/java/spring/setup#build_files
[My Setup: Java EE 6 application, with EJB3.1, CDI/Weld, JSF2 running on Glassfish 3.0.1]
[My Setup: Java EE 6 application, with EJB3.1, CDI/Weld, JSF2 running on Glassfish 3.0.1]
The setup I have is I'm using a Java application to call native C-code
I've done my best to setup Eclipse and my Java application to use a
I have setup google checkout for my java web application and I want to
I'm trying to setup a kiosk type system in linux where a java application
How can I setup a quartz.config file in a simple Java application? I want
I'm having a problem with the following setup: A Java application send email msg
I've got a (fairly typical) setup at the moment of launching my Java application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.