Clarity

How to use <gel:log> for Gel script testing via a command shell 

08-13-2014 06:48 PM

If you use <gel:out> in your script for debugging you will find yourself reworking them into <gel:log> statements before moving it to your target process.

 

In order to get your <gel:log> messages to your console screen you just need two things:

  1. Add a log4j.logger.com.niku.union.gel=info property to a log4j.properties file.
  2. Edit the gel.bat file (save a copy to revert to if needed) and add a –D argument pointing to the log4j.properties file:

          -Dlog4j.configuration="file:\%NIKU_HOME%\lib\log4j.properties"

 

So in my case, I placed the log4j.properties file inside the lib folder.

 

So my log4.properties file looks like this: (I also have a RunGel.log file created for large gel script runs)

 

### set log levels - for more verbose logging change 'info' to 'debug' ###
### Also add logfile to the root, if need stdout then add stdout appender here###
log4j.rootLogger=info, R

log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=RunGel.log
log4j.appender.R.MaxFileSize=100KB
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n

log4j.logger.com.niku.union.gel=info

 

And the java command in the gel.bat looks like this:

 

Java -Xms32m -Xmx512m -cp "%CLASSPATH%" -Dniku.home="%NIKU_HOME%" -Dlog4j.configuration="file:\%NIKU_HOME%\lib\log4j.properties" -Dforehead.conf.file="%NIKU_HOME%\bin\gel.forehead" com.werken.forehead.Forehead -installDir "%NIKU_HOME%" %GEL_ARGS%

 

You should now see all you log messages along with their levels on your console screen.

 

V/r,

Gene

Statistics
0 Favorited
6 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Comments

08-18-2014 02:23 PM

Thanks for sharing this with the community Gene!

08-15-2014 03:47 AM

I just went looking for it and it is a xml file "logger.xml".  For command line gel execution, you can just create a text file with the contents above and save it as log4j.properties file.

 

Just make a copy of your gel.bat (in case you need to revert) and then edit the java command line to add the -Dlog4j.configuration="file:\%NIKU_HOME%\lib\log4j.properties"

 

V/r,

Gene

08-14-2014 01:01 AM

Hi Gene,

 

I am on Clarity v13.3. I searched the entire NIKU_HOME and was not able to find the log4j.properties file. There is only a log4j.jar file in the \%NIKU_HOME%\lib\ folder. Can you please provide the location of this file?

 

The java command in my gel.bat looks like this, with no reference to log4j.properties file anywhere.

java  -Xms32m -Xmx512m -cp "%CLASSPATH%" -Dniku.home="%NIKU_HOME%" -Dforehead.conf.file="%NIKU_HOME%\bin\gel.forehead" com.werken.forehead.Forehead -installDir "%NIKU_HOME%" %GEL_ARGS%

 

Is this feature applicable to all versions of Clarity or only a selected few?

 

Regards,

Georgy

Related Entries and Links

No Related Resource entered.