• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Anything wrong with the way I use log4j2 that I can't get the debug output of my javamail?  RSS feed

 
Ranch Hand
Posts: 496
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to debug what is wrong with my java mail which I tried to send using gmail and in localhost my own computer without a web host.

Now, I have log4j2 and log4j inside so I am not sure if I should remove log4j.  

Also, I just want to log to console to see the error:

Here's my log4j2.xml :





Here's my log4j properties file configuration:

And I have further add the SMTP tracing to logging at Tomcat



BUT, I am not getting any error output

And still I can't send out my email or any debug error


Please. I hope someone can help me on this.
 
Ranch Hand
Posts: 163
5
MS IE Notepad Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this code doesn't compile

- classname ends with parenthesis
- session is defined only inside init() but tried to use in sendMail(String) where it's no longer valid
- wrong port - TCP/465 is socket level TLS - StartTLS is for TCP/25 and TCP/587 only
- modern Type 4 JDBC driver no longer need Class.forName() but will be auto-loaded by serviceloader as long it's in classpath at jvm startup time
 
Bartender
Posts: 20745
124
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, I'm pretty sure that A) Log4j and Log4j2 are mutually exclusive, B) Log4j2 has completely obsoleted log4j C) the log4j2 XML configuration file's default name is simply "log4j.xml".

Consult the documentation, but, as I said, I'm reasonably sure of the above.
 
tangara goh
Ranch Hand
Posts: 496
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Matt Wong wrote:this code doesn't compile

- classname ends with parenthesis
- session is defined only inside init() but tried to use in sendMail(String) where it's no longer valid
- wrong port - TCP/465 is socket level TLS - StartTLS is for TCP/25 and TCP/587 only
- modern Type 4 JDBC driver no longer need Class.forName() but will be auto-loaded by serviceloader as long it's in classpath at jvm startup time



Thanks for the pointers.

I have since corrected the code.  Basically, I just copied and pasted someone else code whom I thought was working...

However, after including the init portion onto the sendEmai(String) method, I am still getting a null point exception at the line which starts with Store



Why am I getting a null pointer exception in this case.

Furthermore, after removing log4j.properties and now there is only log4j2.xml, I am still not getting any log4j debug output...

Not sure if there is anything wrong with the below log4j2.xml ? (Note: I have changed it to log4j.xml)




Thanking you in advance for your advance.
 
Time is the best teacher, but unfortunately, it kills all of its students - Robin Williams. tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!