• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Read a log file and trigger email with same file attached

 
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.
 
Sheriff
Posts: 67269
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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
Sheriff
Posts: 67269
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • 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.
 
Bartender
Posts: 20847
125
Android Eclipse IDE Tomcat Server Redhat Java 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!