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

  • SEARCH
  • Home
  • 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 7173381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:48:45+00:00 2026-05-28T15:48:45+00:00

I’ve done my best to setup Eclipse and my Java application to use a

  • 0

I’ve done my best to setup Eclipse and my Java application to use a log4j.properties file. However, it does not seem to be using the properties file and I’m not sure why.

Libraries: slf4j-api-1.6.1, slf4j-jdk14-1.6.1

Within the application the logging works fine. I am able to print info, warnings, and errors into the Eclipse console.

What I would like to be able to do is change the log level to debug and print all logging messages to both the console and a log file.

I have created a log4j.properties file that looks like this:

log4j.rootLogger=DEBUG,console,file
log4j.rootCategory=DEBUG, R, O

# Stdout
log4j.appender.O=org.apache.log4j.ConsoleAppender

# File
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=log4j.log

# Control the maximum log file size
log4j.appender.R.MaxFileSize=100KB

# Archive log files (one backup file here)
log4j.appender.R.MaxBackupIndex=5
log4j.appender.file.File=checkLog.log
log4j.appender.file.threshold=DEBUG

log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.O.layout=org.apache.log4j.PatternLayout

log4j.appender.R.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n
log4j.appender.O.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n

My directory structure looks like this:

My Project
--src/
----MYProject/
------*.java
--bin/
----MYProject/
------*.class
--log4j/
----log4j.properties

In Eclipse I this this:

Run Configurations -> Classpath (tab) ->, right clicked on User Entries -> Added “log4j” as a new folder, and saved.

Then in my code I call the logger like this (sample code to demonstrate my approach so it may have syntax errors):

package MYProject;
import org.slf4j.LoggerFactory;

public class MyClass{

  final org.slf4j.Logger test_logger = LoggerFactory.getLogger(MyClass.class);

  public MyClass(){}

  public someMethod(){
    test_logger.debug("Some Debug");
    test_logger.info("Some Info");
    test_logger.warn("Some Warning");
    test_logger.error("An Error");
  }

}

I then call someMethod and it prints INFO, WARN, ERROR to the Eclipse console. It won’t print DEBUG and won’t print to a file.

I’d appreciate any suggestions on what I may be 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-05-28T15:48:46+00:00Added an answer on May 28, 2026 at 3:48 pm

    There may be another log4j.properties or log4j.xml file in the classpath ahead of your log4j.properties. Open the run configuration for your project, and add -Dlog4j.debug=true as a VM Argument for your project. This will instruct log4j to print a lot of additional information on the console, including the config file that it is using.

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

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
In my XML file chapters tag has more chapter tag.i need to display chapters
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
i want to parse a xhtml file and display in UITableView. what is the

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.