Title: Hibernate doesn't log anything anymore, since I relocated the log4j.xml and hibernate.properties files
Tags: java;hibernate;log4j
Question: I had the following working organization


```src/main/resources/log4j.xml```
```src/main/resources/hibernate.properties```


I wanted to reorganize my webapp as follow:


```src/main/resources/log/log4j.xml```
```src/main/resources/orm/hibernate.properties```


The ```Logger.info("foobar")``` still logs well (after having set the ```log4jConfigLocation``` context parameter), and the app still has a working database connection. 

The problem is that Hibernate doesn't log anything anymore, even if ```hibernate.show_sql``` is set to ```true```. Any idea why? Should specify the new path to the ```log4j.xml``` file to Hibernate? If yes, how?


Here is the accepted answer: You could run your server with this VM argument:-

```-Dlog4j.configuration=/path/to/log4j.xml
```

I usually tend to place the log4j.xml at the recommended default location unless there's a need to do otherwise... "convention over configuration" is important especially if other peers may be working on the same project in the future.


Here is another answer: Log4j first looks for its configuration by looking at the system property "log4j.configuration". If that system property is not set, it looks for a log4j.properties or a log4j.xml file on the classpath.

So, if you really want the log4j.xml at src/main/resources/log/log4j.xml, you will have to set the log4j configuration system property. This is basically what limc does by supplying it as a vm argument.

Also like limc says, you should probably just keep the log4j.xml at the default location.


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 0, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2013:00:01/11/13', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<java><hibernate><log4j>', 'Title': "Hibernate doesn't log anything anymore, since I relocated the log4j.xml and hibernate.properties files", 'ViewCount': 129, 'id': 14280320, 'user_AboutMe': '', 'user_AccountId': 1268556.0, 'user_DisplayName': 'sp00m', 'user_Reputation': 46907.0, 'user_Views': 3904.0, 'user_id': 1225328.0}}