log4j

Hi, Could anybody tell how to implement log4j logging in JCAPS 5.1.0 ?Does JCAPS provide any in-built log4j capabilities? i'm new to using log4j.just elaborate a bit... thanks!
[205 byte] By [jcapSagea] at [2007-11-27 1:36:31]
# 1
There is built-in logging functionality. You can define what and on what level log or alert either in JCD (business rule designer level) or at activity (see properties tab) level in a business process. It is not necessary to implement your own log4j functionality.O.
ohartvica at 2007-7-12 0:46:07 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...
# 2

Hi,

As other friend said, you can use the default logging facility provided by JCD or Business Process. In case if you want to generate a new .log file, you need to map log4j properties and specifiy the file name in JCD.

So all the JCD events will be logged into this file.

Thanks

Ramanuja

Mvelamarthya at 2007-7-12 0:46:07 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...
# 3
Thanks.could u elaborate how to map log4j properties and specifiy the file name in JCD?.. So all the JCD events will be logged into this file.
jcapSagea at 2007-7-12 0:46:07 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...
# 4

Hi,

This is with version 5.1.2:

The log4j.jar is available in edesigner\lib\ext. Import the .jar file in the project and import the same file into your JCD, you are using.

comment out the existing logger and place this statement :

public static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger( "LoggingDemo" );

public void receive( com.stc.connector.appconn.file.FileTextMessage input, com.stc.connector.appconn.file.FileApplication FileClient_1 )

throws Throwable

{

PropertyConfigurator.configure( "C:/log4j.properties" );

logger.info( " In JCD " );

FileClient_1.setText( input.getText() );

FileClient_1.write();

logger.info( " Successfully finished executing " );

}

You have to set the logger object "LoggingDemo" in your properties file. You should keep the log4j.properties in c:/.

Let me know if you experience any problems. I expect TargetInvocationException if your file in is not taken etc.

Thanks

Mvelamarthya at 2007-7-12 0:46:07 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...
# 5

Mvelamarthy,... thank you v. much..

it would be more helpful if you could please send me sample log4j.properties file..

i got InvocationTargetException probably since i didn't set the logger object in log4j.properties file. so now i'm trying to do that..

thanx anyway..

cheers..

jcapSagea at 2007-7-12 0:46:07 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...
# 6
You can find an example in your edesigner\bin directory.
AKsuiteda at 2007-7-12 0:46:07 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...
# 7

Hi,

As other friend suggested you can use the existing log4j file or use the below lines: put all these in log4j.properties file

log4j.appender.FILE=org.apache.log4j.RollingFileAppender

log4j.appender.FILE.append=true

log4j.appender.FILE.bufferSize=8192

log4j.appender.FILE.bufferedIO=false

log4j.appender.FILE.file=/apps/jcaps/logicalhost/logs/isLog4jDemo.log

log4j.appender.FILE.immediateFlush=true

log4j.appender.FILE.maxBackupIndex=10

log4j.appender.FILE.maximumFileSize=10485760

log4j.appender.FILE.layout=org.apache.log4j.PatternLayout

log4j.appender.FILE.layout.conversionPattern=%d{ISO8601} %-5p [%t] [%c] [%x] %m%n

log4j.rootCategory=INFO, FILE

########################################################################

############################# Log4jDemo ###############################

########################################################################

log4j.logger.Log4jDemo =INFO,AppLogging

log4j.appender.Log4jDemo =org.apache.log4j.RollingFileAppender

log4j.appender.Log4jDemo .File=/apps/jcaps/logicalhost/logs/ApplicationLogging.log

log4j.appender.Log4jDemo .layout=org.apache.log4j.PatternLayout

log4j.appender.Log4jDemo .layout.ConversionPattern=%d{ISO8601} %-5p [%t] [%c] [%x] %m%n

########################################################################

You need to change the file names and path according to your setup.

Hope this helps otherwise please let me know.

Thanks

Mvelamarthya at 2007-7-12 0:46:07 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...
# 8

Hi Mvelamarthy and all,

The log4j properties posted by you, was helpful and is working fine for generating log files.

It can be used for sending log info to log files successfully.

Now, can u or anyone plz let me know what are the log4j properties for sending log info to the database tables in case i also need to send logging info in logging tables in a database ?..

It would be again very helpful if u could post log4j properties for logging to a database!

Thanks a lot for guidance!

cheers..

jcapSagea at 2007-7-12 0:46:07 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...
# 9

Hi,

For using log4j with JMSAppender,

Could u please let me know the properties to be specified in log4j.properties. file or can u send me a sample log4j.properties file., if possible.

Also, I would like to know once log messages are published to JMS topic/queue, how they can be retrieved from it?.. Please elaborate.

Thanks,

Irshad

jcapSagea at 2007-7-12 0:46:07 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...
# 10
I would also like to use JMSAppender. I guess this is the good solution for logging to a file from a J2EE application. I couldn't find enough help to enable this so any links to examples or resources are welcome.
sine_morboa at 2007-7-12 0:46:08 > top of Java-index,Java Enterprise System,Java Composite Application Platform Suite -- General Discussion...