My application uses many such packages which are not inborn sun packages and need to download and configure them for application to import properly.
like import org.apache.commons.lang.StringUtils;
or like import org.apache.log4j.Logger;
etc. and also the java advanced packages like group of javax 's packages, I dont wanna to download the entire jdk for this and reconfigure it again,just the javax packages for it?
I got downloaded the rg.apache.log4j.Logger in zip file but not getting how to configure it for use.
Any help will be apreciated.

Regards,
pritam m

Recommended Answers

All 13 Replies

Wouldn't this answer your question?

nope.i already have seen their all the documentation regarding the log4j.But specifying all the other details, nobody commented about the configuration of it.I just got that we need to set the classpath for log4j also.
And classpath examples people gave around the net include directories which are not present in my extracted folder of log4j.
I tried with diff classpath combinations, but nothing worked.How should I tackle this dilemma?

nope.i already have seen their all the documentation regarding the log4j.But specifying all the other details, nobody commented about the configuration of it.I just got that we need to set the classpath for log4j also.
And classpath examples people gave around the net include directories which are not present in my extracted folder of log4j.
I tried with diff classpath combinations, but nothing worked.How should I tackle this dilemma?

What IDE you using?

I am using netbeans, but i think it wont be a problem with the IDE,because the classpath for the jdk is also set in the same way and I am able to execute other applications in either way from netbeans and also from cmd.

have look at this article, it does show how to add resources to your project through IDE

We just come back in circle where we started, to my first link with examples of log4j.

import org.apache.log4j.Logger;
 import org.apache.log4j.BasicConfigurator;

 public class Log4jDemo {

   // Define a static logger variable so that it references the
   static Logger logger = Logger.getLogger(Log4jDemo.class);

   public static void main(String[] args) {

     // Set up a simple configuration that logs on the console.
     BasicConfigurator.configure();

     logger.info("Entering application.");
     Bar bar = new Bar();
     bar.doIt();
     logger.info("Exiting application.");
   }
 }
import org.apache.log4j.Logger;

 public class Bar {
   static Logger logger = Logger.getLogger(Bar.class);

   public void doIt() {
     logger.debug("Did it again!");
   }
 }

Will get me following result

0 [main] INFO log4jdemo.Log4jDemo  - Entering application.
0 [main] DEBUG log4jdemo.Bar  - Did it again!
0 [main] INFO log4jdemo.Log4jDemo  - Exiting application.

To get more out of log4j you need to read documentation...

your comment is appreciated but, this is not what m looking for, I had seen such type of demos before too.And currently not concerned abt the implementation of log4j in the application.But the configuration of it, when u install the log4j, where to put the library files and the setting of the classpath etc.
Did you see my post by name jack in the link i gave above?

sorry to say but, It seems that, you did not read the post properly!
and not visited the link i gave here.
I am aware with uses of log4j or else i have seen such demos online.
My problem is to configure the log4j for the java to find it out??????

>Did you see my post by name jack in the link i gave above?
No I do not see any post by jack, only first starting post by rama_krishna which will be due to me not having account with this site and not wishing to have one.

>where to put the library files and the setting of the classpath etc
>My problem is to configure the log4j for the java to find it out??????
Have to make Java aware trough IDE of the library location was one of the links I provided earlier? You reply to this that you are aware how to add your files and libraries to IDE. So if you did it properly you will have running any of the demos.

Have good day!

thnx peter_budo!
I visited the link you gave me and this time it clicked me something else for my netbeans!
I did it with ' libraries ' right click 'add Jar/folder' and did succesfully.
If you would have said it instead of package it would have been moe easy for me.
Anyways thnx budy,coz ur link only gave this idea..

regards,
multicoder

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.