log4j:WARN No appenders could be found for logger

baby by side

I had written a simple core-java program to test the log4j functionality. I decided to test RollingFileAppender and console appender with that. Everything goes fine, till I run the file. When I run the file I count see the log; instead I have seen a warning like

log4j:WARN No appenders could be found for logger

when I added BasicConfigurator.configure(); I have seen console appender is working fine. But I need to add PropertyConfigurator.configure("log4j.properties") to get the log in the rolling file.

BasicConfigurator is used to do the quick configuration so that the log can be displayed in the screen.

PropertyConfigurator of log4j instructs PropertyConfigurator to parse a configuration file and set up logging accordingly.

You can see a get started guide to log4j in the loose-sheets

Integrating tomcat 6.0 and Eclipse europa

Till now I was using eclipse and tomcat separately, I was not that much serious about deployment, generally I goto the web application folder and edit/compile there itself. I know tomcat can be integrated with Eclipse, but I never tried. Today I have no other go. I need to do it. Here are the steps.

Register Tomcat with Eclipse

Select Window>Preferences

select the server you want to add, here we are adding tomcat 6.0 available under apache node

fill the necessary details

Here you can see the server is added to the list

You can see a new Project called Servers added to the Project explorer, If it is already there, the server might have been appended to the list

now open the corresponding web project to be deployed and start running it (ctrl + F11). Select Run on Server option

specify the server in which the application is to be deployed.

Move the projects to be deployed to the server. Here we have only one.

Thats it. done! see the web page is getting loaded!

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

kuttikaranam

Today I had a new install of Mandriva 2008 linux. I wrote a java code to test the mysql connectivity. It ended with the following exception.

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Last packet sent to the server was 0 ms ago.

Alas, deeper google search gives me a solution that told about the mysql connectivity parameter in /etc/my.cnf

skip-networking

This parameter has been added for some security related reasons. Really I dont know what it is. I just removed that line, which solved this issue.

Next Page »