How to use log4j in glassfish

10,082

Solution 1

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

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

Solution 2

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

Glassfish logger settings

Share:
10,082
Biribu
Author by

Biribu

Updated on June 04, 2022

Comments

  • Biribu
    Biribu almost 2 years

    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.

  • Biribu
    Biribu about 10 years
    I tried but I can't see the log file yet. Also, I don't know what should I do when I have more than one servlet... I have to use one unique file with all servlet files? Modifying that file each time I add or modify a servlet?
  • Biribu
    Biribu about 10 years
    The only problem I have is that I can't use two different servlets writing in two files. The second one doesn't write in its file... But It works more or less
  • Wheezil
    Wheezil almost 7 years
    This link is now broken. However it was captured by the wayback machine here: web.archive.org/web/20160331164043/https://blogs.oracle.com/‌​…