Re: Custom Syslog Format: Appending Exceptions?

2013-05-14 Thread Tomek Kaczynski
Hi,

   In my case I  created a SyslogWrapperLayout which can wrap any other
layout, so I put PatternLayout inside SyslogWrapperLayout. As far as I see
that's the only way to get cusomizeable Layout for syslog. Ah, and one more
thing, I don't use SyslogAppender, but a simple SocketAppender with
SyslogWrapperLayout, it works great,

   Obviously that's not a standard way, but that's how log4j2 should work
;-)



Tomek


On Mon, May 13, 2013 at 8:38 PM, Jason B makotothedra...@gmail.com wrote:

 Looking around at the Syslog support, and I noticed that exceptions aren't
 being sent across the wire.  I understand that there may be some limit to
 how much data we're sending across with Syslog via TCP, but I was curious
 if there was any custom support for formatters with exceptions.

 I came across this old JIRA for that support:

 https://issues.apache.org/jira/browse/LOG4J2-136

 ... and looking into RFC5424Layout, I see that it could be added, but I'm
 not sure if our setup is configured properly to make use of it.

 - Jason Black



Re: Custom Syslog Format: Appending Exceptions?

2013-05-14 Thread Gary Gregory
Would you like to create a JIRA and contribute a patch?

Gary

On May 14, 2013, at 4:11, Tomek Kaczynski tomek.kaczyn...@gmail.com wrote:

 Hi,

   In my case I  created a SyslogWrapperLayout which can wrap any other
 layout, so I put PatternLayout inside SyslogWrapperLayout. As far as I see
 that's the only way to get cusomizeable Layout for syslog. Ah, and one more
 thing, I don't use SyslogAppender, but a simple SocketAppender with
 SyslogWrapperLayout, it works great,

   Obviously that's not a standard way, but that's how log4j2 should work
 ;-)



 Tomek


 On Mon, May 13, 2013 at 8:38 PM, Jason B makotothedra...@gmail.com wrote:

 Looking around at the Syslog support, and I noticed that exceptions aren't
 being sent across the wire.  I understand that there may be some limit to
 how much data we're sending across with Syslog via TCP, but I was curious
 if there was any custom support for formatters with exceptions.

 I came across this old JIRA for that support:

 https://issues.apache.org/jira/browse/LOG4J2-136

 ... and looking into RFC5424Layout, I see that it could be added, but I'm
 not sure if our setup is configured properly to make use of it.

 - Jason Black


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Custom Syslog Format: Appending Exceptions?

2013-05-14 Thread Tomek Kaczynski
Sure, I'll try in following days.


Tomek


On Tue, May 14, 2013 at 2:35 PM, Gary Gregory garydgreg...@gmail.comwrote:

 Would you like to create a JIRA and contribute a patch?

 Gary

 On May 14, 2013, at 4:11, Tomek Kaczynski tomek.kaczyn...@gmail.com
 wrote:

  Hi,
 
In my case I  created a SyslogWrapperLayout which can wrap any other
  layout, so I put PatternLayout inside SyslogWrapperLayout. As far as I
 see
  that's the only way to get cusomizeable Layout for syslog. Ah, and one
 more
  thing, I don't use SyslogAppender, but a simple SocketAppender with
  SyslogWrapperLayout, it works great,
 
Obviously that's not a standard way, but that's how log4j2 should work
  ;-)
 
 
 
  Tomek
 
 
  On Mon, May 13, 2013 at 8:38 PM, Jason B makotothedra...@gmail.com
 wrote:
 
  Looking around at the Syslog support, and I noticed that exceptions
 aren't
  being sent across the wire.  I understand that there may be some limit
 to
  how much data we're sending across with Syslog via TCP, but I was
 curious
  if there was any custom support for formatters with exceptions.
 
  I came across this old JIRA for that support:
 
  https://issues.apache.org/jira/browse/LOG4J2-136
 
  ... and looking into RFC5424Layout, I see that it could be added, but
 I'm
  not sure if our setup is configured properly to make use of it.
 
  - Jason Black
 

 -
 To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
 For additional commands, e-mail: log4j-user-h...@logging.apache.org




Re: Need help: Steps in your INSTALL doc failing

2013-05-14 Thread Jacob Kjome


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 rem...@yahoo.com 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 marylaudeci...@gmail.com 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 garydgreg...@gmail.comwrote:


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 marylaudeci...@gmail.com 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.clinit(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.


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org





-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



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 h...@visi.com 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 rem...@yahoo.com 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 marylaudeci...@gmail.com 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 garydgreg...@gmail.com
 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 marylaudeci...@gmail.com 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.clinit(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(**
 

Re: Need help: Steps in your INSTALL doc failing

2013-05-14 Thread JOSE L MARTINEZ-AVIAL
Assuming the package of Hello.class is the default package(so, no package)
the following should work:
$ java -cp .:./log4j-1.2.17.jar Hello



2013/5/14 Mary Laude marylaudeci...@gmail.com

 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 h...@visi.com 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 rem...@yahoo.com 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 marylaudeci...@gmail.com 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 garydgreg...@gmail.com
  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 marylaudeci...@gmail.com
 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.clinit(Hello.java:6)
  Caused by: java.lang.**ClassNotFoundException:
 org.apache.log4j.Logger
 at java.net.URLClassLoader$1.run(**URLClassLoader.java:366)
 at 

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 marylaudeci...@gmail.comwrote:

 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 h...@visi.com 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 rem...@yahoo.com 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 marylaudeci...@gmail.com 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 garydgreg...@gmail.com
 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 marylaudeci...@gmail.com
 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.clinit(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 

Re: Need help: Steps in your INSTALL doc failing

2013-05-14 Thread Jacob Kjome

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 marylaudeci...@gmail.com 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 h...@visi.com 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 rem...@yahoo.com 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 marylaudeci...@gmail.com 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 garydgreg...@gmail.com
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 marylaudeci...@gmail.com 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.clinit(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 

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 h...@visi.com 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 marylaudeci...@gmail.com 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 h...@visi.com 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 rem...@yahoo.com 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 marylaudeci...@gmail.com 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 garydgreg...@gmail.com
 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 marylaudeci...@gmail.com
 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 

Burst Filter - Use to limit messages sent over a specific period?

2013-05-14 Thread Jason B
I'm attempting to leverage a burst filter in my application.  I wish to log
errors and send e-mails any time we log an error.  The main thing is, I
don't want to send more than a few e-mails in a given time period (say, one
per event per fifteen minutes), to avoid overwhelming my inbox with these
error events.

Burst Filter seems appropriate for this role, but the documentation is
lacking.  For instance:

 - If I want a filter to accept only those events that happen after the
threshold, but rest for that fifteen minute period of time, how would I
accomplish this?  The configuration is less than intuitive here.

 - What is the role of TimeBasedTriggeringPolicy /? It's not mentioned
anywhere on the site, and only by digging in the source could I actually
determine what it's supposed to be doing.  It's also listed in every
example for filters on the site.

Thanks for clearing up any confusion.

- Jason Black


Re: Custom Syslog Format: Appending Exceptions?

2013-05-14 Thread Jason B
I find this interesting...you had to go back a few levels to implement this
sort of custom behavior.  I'd love to see your patches, since I'm curious
if this can be incorporated into the SyslogAppender as opposed to going one
or two levels above it.

- Jason Black


On Tue, May 14, 2013 at 2:10 AM, Tomek Kaczynski
tomek.kaczyn...@gmail.comwrote:

 Hi,

In my case I  created a SyslogWrapperLayout which can wrap any other
 layout, so I put PatternLayout inside SyslogWrapperLayout. As far as I see
 that's the only way to get cusomizeable Layout for syslog. Ah, and one more
 thing, I don't use SyslogAppender, but a simple SocketAppender with
 SyslogWrapperLayout, it works great,

Obviously that's not a standard way, but that's how log4j2 should work
 ;-)



 Tomek


 On Mon, May 13, 2013 at 8:38 PM, Jason B makotothedra...@gmail.com
 wrote:

  Looking around at the Syslog support, and I noticed that exceptions
 aren't
  being sent across the wire.  I understand that there may be some limit to
  how much data we're sending across with Syslog via TCP, but I was curious
  if there was any custom support for formatters with exceptions.
 
  I came across this old JIRA for that support:
 
  https://issues.apache.org/jira/browse/LOG4J2-136
 
  ... and looking into RFC5424Layout, I see that it could be added, but I'm
  not sure if our setup is configured properly to make use of it.
 
  - Jason Black
 



Re: Adding appenders programatically

2013-05-14 Thread Te Ta
What is the recommended way of adding appenders in log4j 2.

In older version we were able to do
Logger.getLogger(theCategory).addAppender(appender).

Thanks!


On Tue, May 14, 2013 at 7:51 PM, Te Ta ttashiu...@gmail.com wrote:

 What is the recommended way of adding appenders in log4j 2.

 In older version we were able to do
 Logger.getLogger(theCategory).addAppender(appender).

 Thanks!