Biribu
Biribu

Reputation: 3823

How to use log4j in glassfish

I am trying to deploy a tomcat servlet in glassfish and after a couple of weeks making changes I did it.

Now I have another problem. I am using log4f to create log files to store my logs and it doesn't work.

I read that I should make some modifications but I don't know what to do exactly.

I have my log4j.properties and logback.xml files. I have other 2 servlet also with this library and also writing to their own files fine in tomcat. So I need an explanation valid for any servlet.

If you need any config file to be shown here, just tell me. I don't know what to show you.

Upvotes: 3

Views: 10966

Answers (3)

John
John

Reputation: 3996

The link @Gabriel gives was very helpful but the log4j.properties provided there did not work for me. This did:

# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1

# A1 Configuration
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout 
log4j.appender.A1.layout.ConversionPattern=SERVER: %d{DATE} %-5p %c{1} : %m%n

Upvotes: 0

acpuma
acpuma

Reputation: 519

Glassfish admin console -> Configurations -> Server-config -> Logger Settings -> Log levels -> Add Logger -> org.hibernate.type : FINEST

Glassfish logger settings

Upvotes: 1

Gabriel
Gabriel

Reputation: 2021

GlassFish does not provide Log4J support by default can you check this:

https://blogs.oracle.com/naman/entry/configure_log4j_for_use_in

Upvotes: 2

Related Questions