Re: Need help: Steps in your INSTALL doc failing

2013-05-14 Thread Mary Laude
This worked!  (see below)  Thanks to all.

Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
$ java -cp ".;./log4j-1.2.17.jar" Hello
0 [main] DEBUG Hello  - Hello world.
0 [main] INFO Hello  - What a beatiful day.

Mary


On Tue, May 14, 2013 at 9:06 AM, Jacob Kjome  wrote:

> Whoops, I neglected one thing...
>
> java -cp .;log4j-1.2-17.jar Hello
>
>
> Notice I added the current directory to the classpath.  Change the
> classpath separator character to a colon if needed.
>
>
> Jake
>
>
> On Tue, 14 May 2013 09:00:57 -0700
>  Mary Laude  wrote:
>
>> Here is what I just did.  Note I am actually inside a Win VM, at a cygwin
>> prompt.
>>
>> Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
>> $ ls
>> build.properties.sample  **INSTALL   log4j-1.2.17.jar  **
>> site
>> build.xml**JarDir.class  NOTICE  **
>>   src
>> contribs JarDir.java   NTEventLogAppender.amd64.dll  **
>> tests
>> examples KEYS  **NTEventLogAppender.dll
>> Hello.java   LICENSE   pom.xml
>>
>> Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
>> $ echo $CLASSPATH
>> /home/Mary/apache-log4j-1.2.**17/
>>
>> Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
>> $ javac -cp ./log4j-1.2.17.jar Hello.java
>>
>> Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
>> $ java -cp ./log4j-1.2.17.jar Hello
>> Error: Could not find or load main class Hello
>>
>> Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
>> $ ls
>> build.properties.sample  **Hello.javaLICENSE **
>> pom.xml
>> build.xml**INSTALL   log4j-1.2.17.jar  **
>> site
>> contribs JarDir.class  NOTICE  **
>>   src
>> examples JarDir.java   NTEventLogAppender.amd64.dll  **
>> tests
>> Hello.class  KEYS ** NTEventLogAppender.**dll
>>
>>
>> Any ideas?
>> Thx.
>> Mary
>>
>>
>> On Tue, May 14, 2013 at 8:36 AM, Jacob Kjome  wrote:
>>
>>
>>> No, Mary is just running an example from the install documentation.  And
>>> since the code is calling BasicConfigurator.configure(), there is no need
>>> for a config file in the classpath (though it is generally recommended to
>>> use a config file rather than configure via code).
>>>
>>> Mary, please provide an example of your java command line when you run
>>> this.  It should look something like...
>>>
>>>
>>> java -cp log4j-1.2-17.jar Hello
>>>
>>>
>>> Jake
>>>
>>>
>>> On Tue, 14 May 2013 10:41:18 +0900
>>>   Remko Popma  wrote:
>>>
>>>  Mary,
>>>>
>>>> Gary was referring to log4j-2.0. While generally more awesome (ahem), it
>>>> does need those 2 jars to run.
>>>> You seem to be using log4j-1.2. Then you should only need the one jar.
>>>> You also need a log4j.properties or log4j.xml file in a directory that
>>>> is
>>>> in the classpath. The site should have some sample config files.
>>>> In your code, I don't think you need to call
>>>> BasicConfigurator.configure();
>>>> I think you can safely remove that line; log4j will pick up your config
>>>> file from the classpath.
>>>> Sent from my iPhone
>>>>
>>>> On 2013/05/14, at 10:30, Mary Laude  wrote:
>>>>
>>>>   Hey -  thanks for the quick reply!  Ya know, I read that bit
>>>>
>>>>> but the jar file I have is named log4j-1.2-17.jar, and I thought
>>>>> it comprised everything.  When I downloaded the code, that's
>>>>> the only jar file there was.  Clearly, I was delusional!  I'll go
>>>>> look for the corresponding API and core jar files...
>>>>> Thanks again!
>>>>>
>>>>>
>>>>>
>>>>> On Mon, May 13, 2013 at 6:00 PM, Gary Gregory >>>> >wrote:
>>>>>
>>>>>   You need the API and core jar files on your classpath for compilation
>>>>>
>>>>>> and runtime.
>>>>>>
>>>>>> Gary
>>>>>>
>>>>>> On May 13, 2013, at 20:46, Mary Laude 
>>>>>> wrote:
>>>>>>
>>>>>>   Hello -
>>>>&g

Re: Need help: Steps in your INSTALL doc failing

2013-05-14 Thread Mary Laude
Also, if it helps, I've got jdk1.7.0_21 installed for java stuff.
Mary


On Tue, May 14, 2013 at 9:00 AM, Mary Laude wrote:

> Here is what I just did.  Note I am actually inside a Win VM, at a cygwin
> prompt.
>
> Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
> $ ls
> build.properties.sample  INSTALL   log4j-1.2.17.jar  site
> build.xmlJarDir.class  NOTICEsrc
> contribs JarDir.java   NTEventLogAppender.amd64.dll  tests
> examples KEYS  NTEventLogAppender.dll
> Hello.java   LICENSE   pom.xml
>
> Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
> $ echo $CLASSPATH
> /home/Mary/apache-log4j-1.2.17/
>
> Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
> $ javac -cp ./log4j-1.2.17.jar Hello.java
>
> Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
> $ java -cp ./log4j-1.2.17.jar Hello
>
> Error: Could not find or load main class Hello
>
> Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
> $ ls
> build.properties.sample  Hello.javaLICENSE
> pom.xml
> build.xmlINSTALL   log4j-1.2.17.jar  site
> contribs JarDir.class  NOTICEsrc
> examples JarDir.java   NTEventLogAppender.amd64.dll  tests
> Hello.class  KEYS  NTEventLogAppender.dll
>
>
> Any ideas?
> Thx.
> Mary
>
>
> On Tue, May 14, 2013 at 8:36 AM, Jacob Kjome  wrote:
>
>>
>> No, Mary is just running an example from the install documentation.  And
>> since the code is calling BasicConfigurator.configure(), there is no need
>> for a config file in the classpath (though it is generally recommended to
>> use a config file rather than configure via code).
>>
>> Mary, please provide an example of your java command line when you run
>> this.  It should look something like...
>>
>>
>> java -cp log4j-1.2-17.jar Hello
>>
>>
>> Jake
>>
>>
>> On Tue, 14 May 2013 10:41:18 +0900
>>  Remko Popma  wrote:
>>
>>> Mary,
>>>
>>> Gary was referring to log4j-2.0. While generally more awesome (ahem), it
>>> does need those 2 jars to run.
>>> You seem to be using log4j-1.2. Then you should only need the one jar.
>>> You also need a log4j.properties or log4j.xml file in a directory that is
>>> in the classpath. The site should have some sample config files.
>>> In your code, I don't think you need to call
>>> BasicConfigurator.configure();
>>> I think you can safely remove that line; log4j will pick up your config
>>> file from the classpath.
>>> Sent from my iPhone
>>>
>>> On 2013/05/14, at 10:30, Mary Laude  wrote:
>>>
>>>  Hey -  thanks for the quick reply!  Ya know, I read that bit
>>>> but the jar file I have is named log4j-1.2-17.jar, and I thought
>>>> it comprised everything.  When I downloaded the code, that's
>>>> the only jar file there was.  Clearly, I was delusional!  I'll go
>>>> look for the corresponding API and core jar files...
>>>> Thanks again!
>>>>
>>>>
>>>>
>>>> On Mon, May 13, 2013 at 6:00 PM, Gary Gregory >>> >wrote:
>>>>
>>>>  You need the API and core jar files on your classpath for compilation
>>>>> and runtime.
>>>>>
>>>>> Gary
>>>>>
>>>>> On May 13, 2013, at 20:46, Mary Laude 
>>>>> wrote:
>>>>>
>>>>>  Hello -
>>>>>>
>>>>>> I can write, compile, and successfully run a Java program
>>>>>> to look at a .jar file and list the classes defined therein, but
>>>>>> I can't for the life of me get your "Using log4j" java code shown
>>>>>> in 1-2.17's INSTALL doc to work.
>>>>>>
>>>>>> Perhaps there's some other magic that needs to happen to get
>>>>>> this code snippet you wrote to yield output?
>>>>>>
>>>>> --**--**
>>>>> 
>>>>>
>>>>>> You can now test your installation by first compiling the following
>>>>>>   simple program.
>>>>>>
>>>>>>import org.apache.log4j.Logger;
>>>>>>import org.apache.log4j.**BasicConfigurator;
>>>>

Re: Need help: Steps in your INSTALL doc failing

2013-05-14 Thread Mary Laude
Here is what I just did.  Note I am actually inside a Win VM, at a cygwin
prompt.

Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
$ ls
build.properties.sample  INSTALL   log4j-1.2.17.jar  site
build.xmlJarDir.class  NOTICEsrc
contribs JarDir.java   NTEventLogAppender.amd64.dll  tests
examples KEYS  NTEventLogAppender.dll
Hello.java   LICENSE   pom.xml

Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
$ echo $CLASSPATH
/home/Mary/apache-log4j-1.2.17/

Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
$ javac -cp ./log4j-1.2.17.jar Hello.java

Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
$ java -cp ./log4j-1.2.17.jar Hello
Error: Could not find or load main class Hello

Mary@WinServ2008-Enterprise /home/Mary/apache-log4j-1.2.17
$ ls
build.properties.sample  Hello.javaLICENSE   pom.xml
build.xmlINSTALL   log4j-1.2.17.jar  site
contribs JarDir.class  NOTICEsrc
examples JarDir.java   NTEventLogAppender.amd64.dll  tests
Hello.class  KEYS  NTEventLogAppender.dll


Any ideas?
Thx.
Mary


On Tue, May 14, 2013 at 8:36 AM, Jacob Kjome  wrote:

>
> No, Mary is just running an example from the install documentation.  And
> since the code is calling BasicConfigurator.configure(), there is no need
> for a config file in the classpath (though it is generally recommended to
> use a config file rather than configure via code).
>
> Mary, please provide an example of your java command line when you run
> this.  It should look something like...
>
>
> java -cp log4j-1.2-17.jar Hello
>
>
> Jake
>
>
> On Tue, 14 May 2013 10:41:18 +0900
>  Remko Popma  wrote:
>
>> Mary,
>>
>> Gary was referring to log4j-2.0. While generally more awesome (ahem), it
>> does need those 2 jars to run.
>> You seem to be using log4j-1.2. Then you should only need the one jar.
>> You also need a log4j.properties or log4j.xml file in a directory that is
>> in the classpath. The site should have some sample config files.
>> In your code, I don't think you need to call
>> BasicConfigurator.configure();
>> I think you can safely remove that line; log4j will pick up your config
>> file from the classpath.
>> Sent from my iPhone
>>
>> On 2013/05/14, at 10:30, Mary Laude  wrote:
>>
>>  Hey -  thanks for the quick reply!  Ya know, I read that bit
>>> but the jar file I have is named log4j-1.2-17.jar, and I thought
>>> it comprised everything.  When I downloaded the code, that's
>>> the only jar file there was.  Clearly, I was delusional!  I'll go
>>> look for the corresponding API and core jar files...
>>> Thanks again!
>>>
>>>
>>>
>>> On Mon, May 13, 2013 at 6:00 PM, Gary Gregory >> >wrote:
>>>
>>>  You need the API and core jar files on your classpath for compilation
>>>> and runtime.
>>>>
>>>> Gary
>>>>
>>>> On May 13, 2013, at 20:46, Mary Laude  wrote:
>>>>
>>>>  Hello -
>>>>>
>>>>> I can write, compile, and successfully run a Java program
>>>>> to look at a .jar file and list the classes defined therein, but
>>>>> I can't for the life of me get your "Using log4j" java code shown
>>>>> in 1-2.17's INSTALL doc to work.
>>>>>
>>>>> Perhaps there's some other magic that needs to happen to get
>>>>> this code snippet you wrote to yield output?
>>>>>
>>>> --**--**
>>>> 
>>>>
>>>>> You can now test your installation by first compiling the following
>>>>>   simple program.
>>>>>
>>>>>import org.apache.log4j.Logger;
>>>>>import org.apache.log4j.**BasicConfigurator;
>>>>>
>>>>>public class Hello {
>>>>>
>>>>>  private static final Logger logger =
>>>>> Logger.getLogger(Hello.class);
>>>>>
>>>>>  public
>>>>>  static
>>>>>  void main(String argv[]) {
>>>>>BasicConfigurator.configure();
>>>>>logger.debug("Hello world.");
>>>>>logger.info("What a beatiful day.");
>>>>>  }
>>>>>}
>>>>

Re: Need help: Steps in your INSTALL doc failing

2013-05-13 Thread Mary Laude
Hey -  thanks for the quick reply!  Ya know, I read that bit
but the jar file I have is named log4j-1.2-17.jar, and I thought
it comprised everything.  When I downloaded the code, that's
the only jar file there was.  Clearly, I was delusional!  I'll go
look for the corresponding API and core jar files...
Thanks again!



On Mon, May 13, 2013 at 6:00 PM, Gary Gregory wrote:

> You need the API and core jar files on your classpath for compilation
> and runtime.
>
> Gary
>
> On May 13, 2013, at 20:46, Mary Laude  wrote:
>
> > Hello -
> >
> > I can write, compile, and successfully run a Java program
> > to look at a .jar file and list the classes defined therein, but
> > I can't for the life of me get your "Using log4j" java code shown
> > in 1-2.17's INSTALL doc to work.
> >
> > Perhaps there's some other magic that needs to happen to get
> > this code snippet you wrote to yield output?
> >
> 
> > You can now test your installation by first compiling the following
> >   simple program.
> >
> >import org.apache.log4j.Logger;
> >import org.apache.log4j.BasicConfigurator;
> >
> >public class Hello {
> >
> >  private static final Logger logger = Logger.getLogger(Hello.class);
> >
> >  public
> >  static
> >  void main(String argv[]) {
> >BasicConfigurator.configure();
> >logger.debug("Hello world.");
> >logger.info("What a beatiful day.");
> >  }
> >}
> >
> -
> > I understand how CLASSPATH works, etc.  I can get it to compile but
> > even if I again (with option -cp) specify exactly where the .class file
> is
> > that it just created from the compile, it still can't find what it needs.
> >
> > Depending on where I've put things and what I tell it, I get one of these
> > failing results when I try to run the executable:
> >
> > (1)
> > java.lang.NoClassDefFoundError: org/apache/log4j/Logger
> >at Hello.(Hello.java:6)
> > Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
> >at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> >at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> >at java.security.AccessController.doPrivileged(Native Method)
> >at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> >at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
> >at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
> >at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
> >... 1 more
> > Exception in thread "main"
> >
> > or (2)
> > Error: Could not find or load main class Hello
> >
> >
> > Please, I am an old UNIX geek but this is really really frustrating me.
> > I have looked literally EVERYWHERE to find out what the problem is
> > but of course I am apparently the first and only person to ever have this
> > problem.  Ha!
> >
> >
> > --
> > Please test what you build.
>
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


-- 
Please test what you build.


Need help: Steps in your INSTALL doc failing

2013-05-13 Thread Mary Laude
Hello -

I can write, compile, and successfully run a Java program
to look at a .jar file and list the classes defined therein, but
I can't for the life of me get your "Using log4j" java code shown
in 1-2.17's INSTALL doc to work.

Perhaps there's some other magic that needs to happen to get
this code snippet you wrote to yield output?

 You can now test your installation by first compiling the following
   simple program.

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

public class Hello {

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

  public
  static
  void main(String argv[]) {
BasicConfigurator.configure();
logger.debug("Hello world.");
logger.info("What a beatiful day.");
  }
}
-
I understand how CLASSPATH works, etc.  I can get it to compile but
even if I again (with option -cp) specify exactly where the .class file is
that it just created from the compile, it still can't find what it needs.

Depending on where I've put things and what I tell it, I get one of these
failing results when I try to run the executable:

(1)
java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at Hello.(Hello.java:6)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 1 more
Exception in thread "main"

or (2)
Error: Could not find or load main class Hello


Please, I am an old UNIX geek but this is really really frustrating me.
I have looked literally EVERYWHERE to find out what the problem is
but of course I am apparently the first and only person to ever have this
problem.  Ha!


-- 
Please test what you build.