473,396 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

log4j: where to put properties file?

Hello,

My application is using a jar file MyJar.jar that uses log4j (I have the
latest release of log4j).
I have put both MyJar.jar and log4j.jar in a directory in my classpath. I
have also
put the file "log4j.properties" into this same directory.

My log4j.properties file reads:
# Default Logging Configuration

log4j.rootLogger=INFO, stdout

#to increase logging level

#log4j.logger.org.dcm4cheri=DEBUG

#to decrease logging level

#log4j.logger.org.dcm4cheri=ERROR

log4j.appender.stdout=org.apache.log4j.ConsoleAppe nder

log4j.appender.stdout.layout=org.apache.log4j.Patt ernLayout

log4j.appender.stdout.layout.ConversionPattern=%d{ ABSOLUTE} %-5p %x - %m\n

When I run the program, I get the following warning:
log4j:WARN No appenders could be found for logger
(org.dcm4cheri.server.ServerImpl).
log4j:WARN Please initialize the log4j system properly.
Any help would be greatly appreciated!

Aaron Boxer

Jul 17 '05 #1
3 180301
"Aaron Boxer" <aa***@oti-canada.com> wrote in message
news:Zs********************@news20.bellglobal.com. ..
| Hello,
|
| My application is using a jar file MyJar.jar that uses log4j (I have the
| latest release of log4j).
| I have put both MyJar.jar and log4j.jar in a directory in my classpath. I
| have also
| put the file "log4j.properties" into this same directory.
|
| My log4j.properties file reads:
|
|
| # Default Logging Configuration
|
| log4j.rootLogger=INFO, stdout
|
| #to increase logging level
|
| #log4j.logger.org.dcm4cheri=DEBUG
|
| #to decrease logging level
|
| #log4j.logger.org.dcm4cheri=ERROR
|
| log4j.appender.stdout=org.apache.log4j.ConsoleAppe nder
|
| log4j.appender.stdout.layout=org.apache.log4j.Patt ernLayout
|
| log4j.appender.stdout.layout.ConversionPattern=%d{ ABSOLUTE} %-5p %x - %m\n
|
|
|
|
|
| When I run the program, I get the following warning:
|
|
| log4j:WARN No appenders could be found for logger
| (org.dcm4cheri.server.ServerImpl).
| log4j:WARN Please initialize the log4j system properly.
|
|
| Any help would be greatly appreciated!
|
| Aaron Boxer
|

log4j.properties needs to be on the classpath where log4j can find it.
--
-P
Jul 17 '05 #2
> |
| Any help would be greatly appreciated!
|
| Aaron Boxer
|

log4j.properties needs to be on the classpath where log4j can find it.


You may also specify the location of the properties by a system property :

java -Dlog4j.configuration=file:///path/to/log4j.properties MyApplication

(is that system property necessary or only optional ?)
Soren

Jul 17 '05 #3
Thanks for your help, guys.

My error actually, the folder with the file was not actually in my
classpath.

Aaron

"Soren" <s_*****@yahoo.com> wrote in message
news:rO*********************@news000.worldonline.d k...
|
| Any help would be greatly appreciated!
|
| Aaron Boxer
|

log4j.properties needs to be on the classpath where log4j can find it.


You may also specify the location of the properties by a system property :

java -Dlog4j.configuration=file:///path/to/log4j.properties MyApplication

(is that system property necessary or only optional ?)
Soren

Jul 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Paul | last post by:
Hello, I've been reading up on security in Java Applets and whilst I understand the concept, I can't successfully get my applet to read a file on my local machine. I discovered from...
1
by: Ragavendra BC | last post by:
Log4j Issue ----------- Hi, I am facing a problem related to Log4j... The problem is such that I have two different Log4j files one in ..properties format and the other in the .xml format.....
1
by: florins | last post by:
Hi, I am new to C#. I'm making a project which requires a property file like this: key1=value1 key2=value2 How can I read/modify this file in C# ? There is a class in C# like Properties in java...
2
by: Sachin | last post by:
Hi All, Is there any class which provides support file properties file similare to java Properties? Basically I looking for reading/writing properties file in C# of format attrName=Value...
7
by: ffmelo | last post by:
I need something like java.util.Properties class... I want to store properties in a text file and to get at runtime. Example in java: text file ------ propertieName1=propertieValue1...
5
by: sajithamol | last post by:
I'm trying to read a properties file using BufferedInputStream and getResourceAsStream(),but getting "java.io.IOException: Stream closed' exception. My properties file is not set in the classpath,...
4
by: Anthony Smith | last post by:
I have a class that calls some web services. I did not want the url of the web services to be hardcoded in the class. What is the best way to go about doing this?
1
by: Kedar Kachare | last post by:
How to use Log4j to create log files using file appender in a Servlet? Also, how to make that Servlet read the log4j.properties file? I have tried following: My web.xml( I use Eclipse europa)...
1
by: sony.m.2007 | last post by:
Hi, Is there any way of creating a properties file for storing key value pairs in C#.Net? Thanks Sony
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.