Victor
Victor

Reputation: 8480

GoogleAppEngine log warning

I create a default project using GoogleAppEngine for java, and when I deploy my application on google server I have the following warning message for the first request.

log4j:WARN No appenders could be found for logger (DataNucleus.Connection).
log4j:WARN Please initialize the log4j system properly.

The log is working fine, but some request are delayed by this problem.

How can I configure it correctly?

Upvotes: 0

Views: 470

Answers (2)

Igor Artamonov
Igor Artamonov

Reputation: 35961

This messages means that there is no log4j configuration is found.

You have to put an configuration for log4j, for example into file named as log4j.properties in app classpath.

Configuration, for example, would be:

log4j.rootLogger=WARN, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{1}:%M:%L - %m%n

If your project is Maven based, then the best place to put log4j.properties will be src/main/resources

Upvotes: 0

aroth
aroth

Reputation: 54796

What makes you sure that this is delaying some of your requests?

GAE does not function like a standard servlet container. Behind the scenes it unloads any webapps that are idle, and then loads them in again only when it gets a new request for that webapp. This is basically equivalent to doing a complete redeploy of your application, and it doesn't even begin until after GAE has received the request. Thus any request that triggers a load operation will be noticeably delayed compared to subsequent requests.

But there are a whole lot of things going on that are contributing to the delay, and I think an uninitialized log4j setup is not making much of an actual difference.

Upvotes: 1

Related Questions