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 7514259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:26:37+00:00 2026-05-30T00:26:37+00:00

I have a very simple application that illustrates the function of logging. I use

  • 0

I have a very simple application that illustrates the function of logging. I use log4j. But I have some trouble with the settings. I downloaded the file log4j-1.2.16.jar. And connect it to my project by Properties -> Java Build Path -> Libraries -> Add External JARs…. Here are my class:

package ru.log4j.log4jhelloworld;

import org.apache.log4j.Logger;

public class MyClass {
    private static final Logger logger = Logger.getLogger(MyClass.class);
    public static void main(String[] args) {
        logger.info("Hello World!");        
    }
}  

My log4j.xml:

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

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

  <appender name="console" class="org.apache.log4j.ConsoleAppender">
    <param name="Target" value="System.out"/>
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="aa %p %c: %m%n"/>
    </layout>
  </appender>    
  <!--Root logger-->
  <root>
    <priority value ="debug" />
    <appender-ref ref="console" />
  </root>

</log4j:configuration>  

And my log4j.properties:

log4j.rootCategory=DEBUG, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern= %p %c: %m%n

In the console displays these exceptions:

log4j:WARN No appenders could be found for logger (ru.log4j.log4jhelloworld.MyClass).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

I do not know how I was supposed to create and connect other supporting files, such as log4j.xml and log4j.properties. And be sure whether they need? In what directory they should be located? What should I still register? Here is my project structure

screen
.

I’m guessing that the error in this. What is my problem? Help me please!

  • 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-30T00:26:39+00:00Added an answer on May 30, 2026 at 12:26 am

    To solve your issue place your your log4j configuration file(i.e. log4j.xml or log4j.properties) in the src folder and it should work fine.

    Moreover you don’t need both files(log4j.xml and log4j.properties), just use one of them.

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

Sidebar

Related Questions

I have a very simple function in my application that does a lot of
I have a very simple application that use a 2 component UIPickerView that causes
I have a simple iPhone application that is very similar to the Page Control
I have a very simple .net application for testing SMTP on .net. But i
My use case is very simple : I have a GUI application, and inside
I am looking for some general feedback here. I have a very simple application
I have a very simple console application that creates a text file. Below is
I have a very simple Win32 application that uses CAtlExeModuleT. The module simply creates
I have a very simple mod_wsgi python application that tries to write to a
I have a very simple web application that have to read and write in

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.