How to set variable which could be used as a configuration for log4j?

Following are the steps which could be used as a configuration for log4j:-

(1) In log4j.xml define variable as ${variable}:

<appender name="FILE" class="org.apache.log4j.FileAppender">    
    <param name="File" value="${logfilename}.log" />
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d::[%t]::%-5p::%c::%x - %m%n" />

(2) Then make sure you set the system property when you start your JVM such as:
java -Dlogfilename=VinayFileLogger com.vinay.myApplication

(3) Alternatively, you can set the system property in code so long as you do it before you create a logger (this is useful if you want your PID in your logs for instance). Such as:
System.setProperty(“logfilename”, ” VinayFileLogger “);

(4) Once that is set you can go ahead and get your loggers as normal and they will log to the dynamic file

How to set VM arguments in Tomcat
(1) Right Mouse Click on Tomcat Server >> Configure Server Connector
(2) Select Preference >> Tomcat >> Tomcat x.x >> JDK
(3) Now, set the VM arguments as per the snapshot.


Chmod Permissions Explained

There are four OCTAL (0..7) digits, which control the file permissions. But often, only three are used. If you use 600 it equals 0600. The missing digit is appended at the beginning of the number. Each of three digits described permissions. Position in the number defines to which group permissions do apply!

1 – can execute
2 – can write
4 – can read

The octal number is the sum of those free permissions, i.e.
3 (1+2) – can execute and write
6 (2+4) – can write and read

Position of the digit in value:
1 – what owner can
2 – what users in the file group(class) can
3 – what users not in the file group(class) can

chmod 600 file – owner can read and write
chmod 700 file – owner can read, write and execute
chmod 666 file – all can read and write
chmod 777 file – all can read, write and execute



HIBERNATE, created by Gavin King, known as the best and dominated object/relational persistence (ORM) tool for Java developers (Now also supports .NET). It provides many elegant and innovative ways to simplifies the relational database handling task in Java.

Why O/R mapping?

(1) Productivity:  It helps developers to get rid of writing complex and tedious SQL statement, no more need of JDBC APIs for result set or data handling. It makes developers more concentrate on the business logic and increases the project’s productivity.

(2) Maintainability: It helps reduce the lines of code, makes system more understandable and emphasizes more on business logic rather than persistence work (SQLs). More important, a system with less code is easier to re-factor.

(3) Portability: It abstracts our application away from the underlying SQL database and SQL dialect. Switching to other SQL database requires few changes in Hibernate configuration file (Write once/ Run-anywhere).