Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Read a log file and trigger email with same file attached  RSS feed

 
Ramya Ms
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to read the contents of a log file present on the server, and trigger email along with the log file attached using JSP.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramya Ms wrote:I want to read the contents of a log file present on the server, and trigger email along with the log file attached using JSP.

No, you don't. JSP is a technology for creating HTML views. Reading a log file and sending email is not something that JSP is suitable for. If you need to do this within the context of a web application, it should be done in Java classes, not JSP.
 
Ramya Ms
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you.. but I can include the java code inside JSP?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is an obsolete and discredited practice since 2001. That's 14 years ago! So no, you should note put Java code in a JSP.

Please read this article to understand how to structure modern Java web apps.
 
Tim Holloway
Bartender
Posts: 18661
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, many loggers are quite capable of sending their own emails without needing a separate application to read the log.

I do that with one of my primary apps. Anything that logs to level FATAL gets emailed to me automatically.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!