Month: April 2011

What is .bashrc

What is .bashrc ?

.bashrc contains the scripts that are executed when ‘BASH’ shell ( Bourne Again Shell ) is launched.  It basically contains the settings that must be enabled for a bash shell when it is launched. The ‘.bashrc’ exist at two levels ie one at the root level ( global one ) and another one at the user level ( ie shell settings specific for that particular user )

Global bashrc location : /etc/

User Specifc location : /home/username/

Ideally all your environment variables like JAVA_HOME should be set inside your .bashrc.

eg :

#Setting Java Home and Path Variable
export JAVA_HOME=/home/mindtree/java/jdk1.6.0_22
export PATH=$JAVA_HOME/bin:$PATH
export ODE_HOME=/home/mindtree/apache-ode-jbi-2.0-beta2
export RAPIDAPPSERVER_HOME=/home/mindtree/RCSBuildXMLFiles

Once you change the contents of .bashrc.  You need to execute the command

$source .bashrc

so that the changes take effect. If this doesn’t work, try starting a new terminal or a new tab within the existing terminal.

More on linux shell scripting @


The Nonsense Blogger 🙂 🙂


log4j Application using Maven

First, the pom.xml that describes the Application build.

<project xmlns="" xmlns:xsi="" xsi:schemaLocation="">


Now the ‘’ file that should be placed in the ‘resources’ folder in the project.

#  The following properties set the logging levels and log appender.  The
#  log4j.rootCategory variable defines the default log level and one or more
#  appenders.  For the console, use 'S'.  For the daily rolling file, use 'R'.
#  For an HTML formatted log, use 'H'.
#  To override the default (rootCategory) log level, define a property of the
#  form (see below for available values):
#        log4j.logger. =
#    Available logger names:
#      TODO
#    Possible Log Levels:

log4j.rootCategory=DEBUG, S, ALL, ERROR

#  The following properties configure the console (stdout) appender.
#  See for details.
log4j.appender.S = org.apache.log4j.ConsoleAppender
log4j.appender.S.layout = org.apache.log4j.PatternLayout
log4j.appender.S.layout.ConversionPattern = [%d{dd-MM-yyyy HH:mm:ss.SSS}] [%p] [%c]: %m%n

#  The following properties configure the Daily Rolling File appender which includes all the log level messages.
#  See for details.
log4j.appender.ALL = org.apache.log4j.DailyRollingFileAppender
log4j.appender.ALL.File = C:/Users/Arun/workspace/DemoLogger/AppLog.log
log4j.appender.ALL.Append = true
log4j.appender.ALL.DatePattern = '.'yyyy-MM-dd
log4j.appender.ALL.layout = org.apache.log4j.PatternLayout
log4j.appender.ALL.layout.ConversionPattern = [%d{dd-MM-yyyy HH:mm:ss.SSS}] [%p] [%c{1}]: %m%n

#  The following properties configure the Daily Rolling File appender which includes all the log level messages.
#  See for details.
log4j.appender.ERROR = org.apache.log4j.DailyRollingFileAppender
log4j.appender.ERROR.File = C:/Users/Arun/workspace/DemoLogger/AppErrorLog.log
log4j.appender.ERROR.Append = true
log4j.appender.ERROR.Threshold = ERROR
log4j.appender.ERROR.DatePattern = '.'yyyy-MM-dd
log4j.appender.ERROR.layout = org.apache.log4j.PatternLayout
log4j.appender.ERROR.layout.ConversionPattern = [%d{dd-MM-yyyy HH:mm:ss.SSS}] [%p] [%c{1}]: %m%n

Now the ‘’ file which contains the demo logging statements.

package com.arun.demo.logger;

import org.apache.log4j.Logger;

public class DemoLogger {

	/* Creating the static logger */
	static Logger logger = Logger.getLogger(DemoLogger.class);

	public static void main(String args[]) {

		int a=3,b;

		logger.debug("Test Debug Message");
		try {

			logger.debug("Before Exception");
			System.out.println("b : "+b);
		catch(Exception e) {

			logger.error("Exception occured :"+e.getMessage());


Here all the logs are printed out on the console. They also get written on the rolling file ‘AppLog.log”. The ‘error’ level logs get written to ‘AppErrorLog.log’

Find below, the ‘Output grab’ from the console.

[15-04-2011 01:32:47.763] [DEBUG] [com.arun.demo.logger.DemoLogger]: Test Debug Message
[15-04-2011 01:32:47.789] [DEBUG] [com.arun.demo.logger.DemoLogger]: Before Exception
[15-04-2011 01:32:47.822] [ERROR] [com.arun.demo.logger.DemoLogger]: Exception occured :/ by zero

Find more on log4j at


The nonsense logger 🙂 🙂