Various fields in log4j.properties

2008-05-08 Thread lp_1431

Kindly please let me know all the fields that can be put in the
log4j.properties file.

Thanks

-- 
View this message in context: 
http://www.nabble.com/Various-fields-in-log4j.properties-tp17120176p17120176.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



JDBCAppender

2008-05-08 Thread Simonebernardi

Hi all,

I have a problem with JDBCAppender. I wrote a configuration file, but 
the table does not write anything and not give me any errors. why?


appender name=JDBC class=org.apache.log4j.jdbc.JDBCAppender
  param name=url 
value=jdbc:mysql://localhost:3306/sicve_uel1/

param name=dbclass value=com.mysql.jdbc.Driver/
param name=username value=sicve/
param name=password value=sicve/
param name=sql value=INSERT INTO logtest (id, prio, 
cat, thread, msg, layout_msg, throwable, ndc, mdc, mdc2, info,
 addon, the_date, the_time, the_timestamp, created_by) 
VALUES (@INC@, '@PRIO@', '@CAT@', '@THREAD@', '@MSG@', '@LAYOUT:1@',
 '@THROWABLE@', '@NDC@', '@MDC:MyMDC@', '@MDC:MyMDC2@', 
'info timestamp: @TIMESTAMP@', 'addon',
 cast ('@LAYOUT:3@' as date), cast ('@LAYOUT:4@' as time), 
cast ('@LAYOUT:3@ @LAYOUT:4@' as timestamp), 'me')/

   param name=buffer value=1/
  param name=commit value=true/
  param name=quoteReplace value=true/
  param name=throwableMaxChars value=3000/
  param name=layoutPartsDelimiter value=#-#/
  layout class=org.apache.log4j.PatternLayout
  param name=ConversionPattern value=[%t] 
%m#-##-#%d{dd.MM.}#-#%d{HH:mm:ss}/

 /layout


 /appender


Thank you

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: JDBCAppender

2008-05-08 Thread Bender Heri
Have you attached the appender to any logger?
Heri

 -Original Message-
 From: Simonebernardi [mailto:[EMAIL PROTECTED]
 Sent: Thursday, May 08, 2008 12:12 PM
 To: log4j-user@logging.apache.org
 Subject: [SPAM (DNS Blacklist)] - JDBCAppender - Sending mail server
 found on list.dsbl.org
 
 
 Hi all,
 
 I have a problem with JDBCAppender. I wrote a configuration file, but 
 the table does not write anything and not give me any errors. why?
 
 appender name=JDBC class=org.apache.log4j.jdbc.JDBCAppender
param name=url 
 value=jdbc:mysql://localhost:3306/sicve_uel1/
  param name=dbclass value=com.mysql.jdbc.Driver/
  param name=username value=sicve/
  param name=password value=sicve/
  param name=sql value=INSERT INTO logtest (id, prio, 
 cat, thread, msg, layout_msg, throwable, ndc, mdc, mdc2, info,
   addon, the_date, the_time, the_timestamp, created_by) 
 VALUES (@INC@, '@PRIO@', '@CAT@', '@THREAD@', '@MSG@', '@LAYOUT:1@',
   '@THROWABLE@', '@NDC@', '@MDC:MyMDC@', '@MDC:MyMDC2@', 
 'info timestamp: @TIMESTAMP@', 'addon',
   cast ('@LAYOUT:3@' as date), cast ('@LAYOUT:4@' 
 as time), 
 cast ('@LAYOUT:3@ @LAYOUT:4@' as timestamp), 'me')/
 param name=buffer value=1/
param name=commit value=true/
param name=quoteReplace value=true/
param name=throwableMaxChars value=3000/
param name=layoutPartsDelimiter value=#-#/
layout class=org.apache.log4j.PatternLayout
param name=ConversionPattern value=[%t] 
 %m#-##-#%d{dd.MM.}#-#%d{HH:mm:ss}/
   /layout
 
  
   /appender
 
 
 Thank you
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: JDBCAppender

2008-05-08 Thread Simonebernardi




Yes 

root
  
  appender-ref ref="JDBC"/
/root



Bender Heri ha scritto:

  Have you attached the appender to any logger?
Heri

  
  
-Original Message-
From: Simonebernardi [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 08, 2008 12:12 PM
To: log4j-user@logging.apache.org
Subject: [SPAM (DNS Blacklist)] - JDBCAppender - Sending mail server
found on list.dsbl.org


Hi all,

I have a problem with JDBCAppender. I wrote a configuration file, but 
the table does not write anything and not give me any errors. why?

appender name="JDBC" class="org.apache.log4j.jdbc.JDBCAppender"
   param name="url" 
value="jdbc:mysql://localhost:3306/sicve_uel1"/
 param name="dbclass" value="com.mysql.jdbc.Driver"/
 param name="username" value="sicve"/
 param name="password" value="sicve"/
 param name="sql" value="INSERT INTO logtest (id, prio, 
cat, thread, msg, layout_msg, throwable, ndc, mdc, mdc2, info,
  addon, the_date, the_time, the_timestamp, created_by) 
VALUES (@INC@, '@PRIO@', '@CAT@', '@THREAD@', '@MSG@', '@LAYOUT:1@',
  '@THROWABLE@', '@NDC@', '@MDC:MyMDC@', '@MDC:MyMDC2@', 
'info timestamp: @TIMESTAMP@', 'addon',
  cast ('@LAYOUT:3@' as date), cast ('@LAYOUT:4@' 
as time), 
cast ('@LAYOUT:3@ @LAYOUT:4@' as timestamp), 'me')"/
param name="buffer" value="1"/
   param name="commit" value="true"/
   param name="quoteReplace" value="true"/
   param name="throwableMaxChars" value="3000"/
   param name="layoutPartsDelimiter" value="#-#"/
   layout class="org.apache.log4j.PatternLayout"
   param name="ConversionPattern" value="[%t] 
%m#-##-#%d{dd.MM.}#-#%d{HH:mm:ss}"/
  /layout

 
  /appender


Thank you

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



  
  
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




  



-- 











  

  
  
   4IT  
   S.r.l.
 Simone Bernardi |  
   Junior Consultant  
  -
 Via Udine 30-36, 00161 Roma
  Phone  
   +39 06 97601680
 Mobile+39 320 5707692
 Fax+39 06 97601683
 [EMAIL PROTECTED]
  www.4it.it  

  

  

 Il presente
messaggio e gli eventuali allegati sono di natura confidenziale. 
Qualora vi fosse pervenuto per errore, vi preghiamo di cancellarlo
immediatamente dal vostro sistema e di avvisare il mittente.  
 Grazie. 
  
 This electronic
mail transmission and any accompanying attachments contain confidential
information. If you have received this communication in error, please
immediately delete the E-mail and either notify the sender. Thank you.
   
   
   





RE: Understanding log levels

2008-05-08 Thread Tasso Angelidis
So as an example?

class MyClass
{
Logger eventLogger = Logger.getLogger(MyClass.EventLogger);
Logger opsLogger = Logger.getLogger(MyClass.OpsLogger);


void someMethod()
{
eventLogeger.warn(Server stoppped);
opsLogger.warn(Server stoppped);
}
}


Isn't that double the work now? What if I want to have the EventLogger writting 
to fileXYZ some events and then when I call OpsLogger.Warn() it sends out the 
e-mail and also writes the message to fileXYZ.

Is this logger nesting? I.e: my OpsLogger should be a child of EventLogger?

Thanks

-Original Message-
From: Curt Arnold [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 07, 2008 12:09 PM
To: Log4J Users List
Subject: Re: Understanding log levels



On May 7, 2008, at 10:22 AM, Tasso Angelidis wrote:

 Hi, I'm currently working on a custom level and logger to send my  
 operations team an e-mail when an error occurs or when an operation  
 log is explicitely written. For instance: logger.operations(Server  
 was shutdown manually.);

 If I call logger.error(...) The log is recorded in my error log  
 and an e-mail is sent. As expected.
 If I call logger.operations(...) The log is written to the error  
 and smtp appenders, when it should only be the SMTP appender. It  
 shouldn't be logged as an error.

 Have I done something wrong or is it simply a config issue?

 Thanks



The better way is to use the logger name to represent the audience or  
topic, not a custom level.  That is exactly what the logger hierarchy  
was designed to represent.  It is just that it is so common to use  
class names as topics that people think that is the only thing that a  
logger name can be.  This question is asked repeatedly in different  
forms, like http://permalink.gmane.org/gmane.comp.jakarta.log4j.user/15285 
.

My suggestion would be to have a separate logger named operations. +  
class name and attach your SMTP appender to the operations logger.
If you use the logger hierarchy as intended, you can use level as  
intended and allow for INFO, WARN or ERROR severities in your  
operations logging.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Understanding log levels

2008-05-08 Thread Curt Arnold


On May 8, 2008, at 8:23 AM, Tasso Angelidis wrote:


So as an example?

class MyClass
{
Logger eventLogger = Logger.getLogger(MyClass.EventLogger);
Logger opsLogger = Logger.getLogger(MyClass.OpsLogger);


void someMethod()
{
eventLogeger.warn(Server stoppped);
opsLogger.warn(Server stoppped);
}
}


Isn't that double the work now? What if I want to have the  
EventLogger writting to fileXYZ some events and then when I call  
OpsLogger.Warn() it sends out the e-mail and also writes the message  
to fileXYZ.


Is this logger nesting? I.e: my OpsLogger should be a child of  
EventLogger?


Thanks



Like defining a directory structure, you have to choose which  
organizational principle is more significant.


If you chose a pattern like operations. + classname, you can route  
all operations related messages to the same place by attaching an  
appender to the operations logger.  If you want all messages related  
to a single class going to the same place, then you'd need to attach  
one appender to both operations.com.example.SomeClass and  
com.example.SomeClass.


If you chose a pattern like classname + .operations or  
.OpsLogger,  you can route all messages related to a specific class  
by attaching an appender to the classname.  However, routing all  
operations related messages to the same place would require attaching  
an appender at multiple places in the hierarchy  
(com.example.SomeClass.operations, com.example.OtherClass.operations,  
etc).


I'm assuming that operations related messages are far less frequent  
that other log messages and the people consuming the diagnostic logs  
would not be offended to see the operations related messages.  That  
would suggest attaching a file appender to the root logger which would  
receive all log messages, operations or otherwise, and an SMTP  
appender that would only process messages logged to an operations  
logger or child.


In your example, eventLogger and opsLogger are siblings, both share  
the same parent the logger named MyClass.


There is no need to log the same message twice.  You can design the  
names of the loggers you use so that one message is processed by two  
different appenders.


So I would suggest:

class MyClass {
Logger logger = Logger.getLogger(MyClass.class);
Logger opsLogger = Logger.getLogger(operations. +  
MyClass.class.getName());


   void shutdown() {
opsLogger.warn(Server stopped);
   }

   void start() {
opsLogger.info(Server started);
   }

   void other renderPage() {
logger.info(Rendering page);
...
   }
}



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: log4j.properties file outside jar file?

2008-05-08 Thread Jacob Kjome
Why do you feel the need to define -Dlog4j.configuration?  Auto-configuration 
should pick up log4j.properties on its own.  Have you tried that?  Otherwise, 
to point to the props inside the jar file, you need...


java -Dlog4j.configuration=jar:file:/full/path/to/myapp.jar!/log4j.properties 
-jar myapp.jar



Jake


On Wed, 7 May 2008 03:01:05 -0700 (PDT)
 AbelMacAdam [EMAIL PROTECTED] wrote:


I changed the entry in the batch file starting the application to:
java -Dlog4j.configuration=file:./log4j.properties -jar myapp.jar

(See the ./ between the file: and log4j.properties?)

I seem not to be able to start the application double clicking the jar
file AND using the log system at the same time.


AbelMacAdam wrote:


Hi,

The application I created uses log4j to log states to a log file. As the
application should run on either Windows or Unix, and either slow, or full
blast (debugging) I had to remove the properties file from the executable
jar file and to the directory that same executable jar file is stored. The
customer can now rename one of the different properties files to
log4j.properties to suite their wishes (either slow logging or full blast,
and dependent on their operating system).

So far the theory. Now getting it to work in practice...

I get the following error message when I start the application using
java -Dlog4j.properties=file:log4j.properties -jar myapp.jar
log4j:WARN No appenders could be found for logger (foo.bar.MyApplication).
log4j:WARN Please initialize the log4j system properly.

The directory structure used is:
path/MyApp
  |-myapp.jar
  |-log4j.properties
  |-log4j_unix_full_logging.properties
  |-log4j_unix_slow_logging.properties
  |-log4j_windows_full_logging.properties
  |-log4j_windows_slow_logging.properties
  |-Readme.txt

Or, stated in text, the executable myapp.jar and log4j.properties file
reside together in the same directory.

I even added a point to my classpath... (set CLASSPATH=.;CLASSPATH). Do
you know what I need to do to get the logging working?

Abel



--
View this message in context: 
http://www.nabble.com/log4j.properties-file-outside-jar-file--tp17100339p17101072.html

Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



log timestamp not in sync with system time

2008-05-08 Thread kadaba

My logs are not in sync with the system time.
I am not sure why this behavior.I had changed timezone to gmt in one of the
classes,I initially thought that this might be the problem but i ran a
sample application in which the behavior did not occur.
I am not sure why this is happening. Can anyone help?
Thanks in advance
-- 
View this message in context: 
http://www.nabble.com/log-timestamp-not-in-sync-with-system-time-tp17141276p17141276.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]