Tuesday, March 5, 2013

Jboss AS 7 Syslog Handler

We recently upgraded our jboss AS to 7.1 and realized that Jboss for some reason had moved from log4j to JUL. We only had to change our jobss-log4j.xml to standalone.xml and most of the logging was unaffected except for Syslogging. Turns out Jboss logging did not have a SyslogHandler neither does JUL. So we decided to implement one for ourselves as is recommended by a number of blog posts. Here is our implementation that simply delegates to log4j SysLogAppender.
1. Download and unzip the module from here org.zip into jboss modules directory
2. Add the following to jboss standalone.xml
3. Restart your jboss to enable Syslogging

The source code can be found here SyslogHandler.java

Tuesday, November 6, 2012

Auto complete ant targets on windows






I was having trouble remembering ant targets when building on windows so I thought it would be nice if I could just type the target names partially and press tab to auto complete them. A little bit of googling showed that its quite easy to do it on linux by modiyfing the .bashrc file.

I found that I could do this on windows by creating 0 byte files with the target names. So I wrote a small bat script  to do this for me. All you have to do is copy the follwing script into a file called antl.cmd into ANT_HOME\bin.


 @echo off  
 findstr "<target" build.xml > _o  
 echo targets in build.xml  
 echo.  
 FOR /F "eol=; tokens=1,2,3,4,5,* delims=,>,=, " %%i in (_o) do (  
      echo %%~k  
      REM. > %%~k  
 )  
 del _o  



After that if you do type antl into a shell where you are building your code the script creates the 0 byte files
for you. and voila!! you have auto complete