Lecture XI: Logging and Monitoring CS 4593 Cloud-Oriented Big Data and Software Engineering.

Slides:



Advertisements
Similar presentations
Microsoft Standard TCP/IP Port Monitor Futures
Advertisements

4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
6 Copyright © 2005, Oracle. All rights reserved. Using Advanced Techniques in Servlets.
JLab Lattice Portal – Data Grid Web Service Ying Chen, Chip Watson Thomas Jefferson National Accelerator Facility.
Web Development with Karsten Schulz Terp-Nielsen Master Principal Sales Consultant Oracle Denmark.
Logging in Java applications Sean C. Sullivan July 23, 2002 Portland Java Users Group.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 34 Servlets.
Introduction to Java A lab course by Dr. Junaid Ahmed Zubairi SUNY Fredonia.
ASP.NET 2.0 Chapter 6 Securing the ASP.NET Application.
CONTENTS:-  What is Event Log Service ?  Types of event logs and their purpose.  How and when the Event Log is useful?  What is Event Viewer?  Briefing.
Struts 2.0 an Overview ( )
Lecture 2 - Struts ENTERPRISE JAVA. 2 Contents  Servlet Deployment  Servlet Filters  Model View Controllers  Struts  Dependency Injection.
IT533 Lectures Configuring, Deploying, Tracing and Error Handling.
ASHIMA KALRA.  INTRODUCTION TO JSP INTRODUCTION TO JSP  IMPLICIT OBJECTS IMPLICIT OBJECTS  COOKIES COOKIES.
New SA Training Topic 9: Logging, Monitoring, and Performance  Logging  Windows – “Auditing”  Linux – syslog  Monitoring  MRTG  Big Brother  Performance.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
DONE-10: Adminserver Survival Tips Brian Bowman Product Manager, Data Management Group.
Logging Best Practices Dubna 2012 Benedicto Fernandez Software Engineer CERN / GS-AIS.
Logging with Log4j. Introduction Logging - chronological and systematic record of data processing events in a program. Possible goals: Create an audit.
© 2007 IBM Corporation IBM Global Engineering Solutions IBM Blue Gene/P Blue Gene/P Navigator.
Session 10 Windows Platform Eng. Dina Alkhoudari.
Copyright ®xSpring Pte Ltd, All rights reserved Versions DateVersionDescriptionAuthor May First version. Modified from Enterprise edition.NBL.
Java Android-8 Imran Shafi. Lecture Contents  Debugging Android Projects  Java/XML Errors  Debugger  Logcat Utility  Android Debug Bridge (adb) 
Java support for WWW Babak Esfandiari (sources: Qusay Mahmoud, Roger Impey, textbook)
COLD FUSION Deepak Sethi. What is it…. Cold fusion is a complete web application server mainly used for developing e-business applications. It allows.
Chapter 5 Java Servlets. Objectives Explain the nature of a servlet and its operation Use the appropriate servlet methods in a web application Code the.
CGS – 4854 Summer 2012 Web Site Construction and Management Instructor: Francisco R. Ortega Chapter 2.
LogBox Enterprise Logging Brad Wood
Web Server Programming 1. Nuts and Bolts. Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some.
Exceptions Handling Exceptionally Sticky Problems.
Java Servlets & Java Server Pages Lecture July 2013.
ARCSDE & ARCIMS Mr. David A. Perini. ARCIMS  Internet Mapping Server Distribute GIS information over the Internet Integrates with addition ESRI softwareESRI.
JSP Filters 23-Oct-15. JSP - FILTERS A filter is an object that can transform a request or modify a response. Filters are not servlets; they don't actually.
10/25/20151 Single Sign-On Web Service Supervisors: Viktor Kulikov Alexander Sherman Liana Lipstov Pavel Bilenko.
By: Rick Varella, Cuong Nguyen, & Henry Giathi. What is Books Zen Books? Books Zen Books is an e-commerce web application designed to allow students to.
Sonic EventMonitor Monitoring your Sonic environment Tako Grijpma Progaia Resource Solutions 09 november 2006.
Self-assembling Agent System Presentation 1 Donald Lee.
® IBM Software Group © 2007 IBM Corporation Best Practices for Session Management
20-Nov-15introServlets.ppt Intro to servlets. 20-Nov-15introServlets.ppt typical web page – source Hello Hello.
Intrusion Intrusion Detection Systems with Snort Hailun Yan 564-project.
GUDURU PRAVEEN REDDY.NET IMPERSONATION. Contents Introduction Impersonation Enabled Impersonation Disabled Impersonation Class Libraries Impersonation.
Vinay Paul. CONTENTS:- What is Event Log Service ? Types of event logs and their purpose. How and when the Event Log is useful? What is Event Viewer?
Servlet Filters import java.io.*; import javax.servlet.*; import javax.servlet.http.*; public class TimerFilter implements Filter { /* J2EE v1.3 Filter.
How to implement GPOs and secure a MS Windows Environment with little to NO user awareness!?!?
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, Responds oriented other.
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
©SoftMoore ConsultingSlide 1 Filters. Filters can be used in a web application to intercept, examine, and possibly transform requests or responses associated.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Persistence – Iteration 4 Vancouver Bootcamp Aaron Zeckoski
MIT AITI 2004 JSP – Lecture 4 Sessions and Cookies.
Lecture III: Challenges for software engineering with the cloud CS 4593 Cloud-Oriented Big Data and Software Engineering.
System Design for Home Automaton. Design Goals Performance Criteria – Server prioritizes client requests to provide quick response time to critical requests.
April 20023CSG11 Electronic Commerce Java (2) John Wordsworth Department of Computer Science The University of Reading Room 129,
The Chain of Responsibility Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
Lecture XV: Review CS 4593 Cloud-Oriented Big Data and Software Engineering.
CS520 Web Programming Bits and Pieces of Web Programming (I) Chengyu Sun California State University, Los Angeles.
how to configure Gmail account in MS Outlook 2010 account?
Introduction to Servlets
Featured Enhancements to the IDE & Debugger
Java Servlets By: Tejashri Udavant..
Pre assessment Questions
Servlets Hits Counter 20-Jul-18.
Pre-assessment Questions
TYPES OF SERVER. TYPES OF SERVER What is a server.
WEB API.
CANalytics TM CAN Interface Software BY.
Chapter 26 Servlets.
Chengyu Sun California State University, Los Angeles
Introduction to Java Servlets
Presentation transcript:

Lecture XI: Logging and Monitoring CS 4593 Cloud-Oriented Big Data and Software Engineering

2 Logging and Monitoring  Basic and Logging frameworks  Logging and monitoring for web services

Basic Tracing Logging Auditing

First Logging: System.out.println Easy Quick No dependencies Redirect to file or null in Production Log everything or nothing System.out.println(“Start method1”);

Example Start method1 Before retrieve information from DB After retrieve information from DB Updating information Before save information in the DB After save information in the DB Finish method1 Start method2 Before retrieve information from DB Error retrieving information from DB: NullPointerException

Next evolution: Logging Libraries Log4j, Java Logging… log.info(“Start method1”); Provide Time of the message The class, the method, the line … Print easily the stacktrace Log to files, databases, system log mechanisms

Example 06:05: INFO (Class1.java:211) Start method2 06:05: INFO (Class1.java:220) Before retrieve information from DB 06:05: INFO (Class1.java:243) Error retrieving information from DB: NullPointerException java.lang.NullPointerException at pkg.Class1.method2(Class1.java:225) at pkg.Class1.methodN(Class1.java:458) at pkg2.ClassZ.methodUpdate(ClassZ.java:458) at … at java.lang.Thread.run(Thread.java:595)

Example 06:05: INFO (Class1.java:211) Start method2 06:05: INFO (Class1.java:220) Before retrieve information from DB 06:05: INFO (Class1.java:243) Error retrieving information from DB: NullPointerException java.lang.NullPointerException at pkg.Class1.method2(Class1.java:225) at pkg.Class1.methodN(Class1.java:458) at pkg2.ClassZ.methodUpdate(ClassZ.java:458) at … at java.lang.Thread.run(Thread.java:595)

Example 06:05: INFO ( Class1.java:211 ) Start method2 06:05: INFO (Class1.java:220) Before retrieve information from DB 06:05: INFO (Class1.java:243) Error retrieving information from DB: NullPointerException java.lang.NullPointerException at pkg.Class1.method2(Class1.java:225) at pkg.Class1.methodN(Class1.java:458) at pkg2.ClassZ.methodUpdate(ClassZ.java:458) at … at java.lang.Thread.run(Thread.java:595)

Example 06:05: INFO (Class1.java:211) Start method2 06:05: INFO (Class1.java:220) Before retrieve information from DB 06:05: INFO (Class1.java:243) Error retrieving information from DB: NullPointerException java.lang.NullPointerException at pkg.Class1.method2(Class1.java:225) at pkg.Class1.methodN(Class1.java:458) at pkg2.ClassZ.methodUpdate(ClassZ.java:458) at … at java.lang.Thread.run(Thread.java:595)

Logging levels (I) Log4j Trace Debug Info Warning Error Fatal Java Logging Finest Finer Fine Config Info Warning Severe

Example 06:05: INFO (Class1.java:211) Start method2 06:05: INFO (Class1.java:211) Parameter ‘age’ is not an Integer 06:05: INFO (Class1.java:211) Finish method2 06:05: INFO (Class1.java:211) Start method2 06:05: DEBUG (Class1.java:220) Before retrieve information from DB 06:05: ERROR (Class1.java:243) Error retrieving information from DB: NullPointerException java.lang.NullPointerException at pkg.Class1.method2(Class1.java:225) at pkg.Class1.methodN(Class1.java:458) at pkg2.ClassZ.methodUpdate(ClassZ.java:458) at … at java.lang.Thread.run(Thread.java:595)

Example 06:05: INFO (Class1.java:211) Start method2 06:05: INFO (Class1.java:211) Parameter ‘age’ is not an Integer 06:05: INFO (Class1.java:211) Finish method2 06:05: INFO (Class1.java:211) Start method2 06:05: DEBUG (Class1.java:220) Before retrieve information from DB 06:05: ERROR (Class1.java:243) Error retrieving information from DB: NullPointerException java.lang.NullPointerException at pkg.Class1.method2(Class1.java:225) at pkg.Class1.methodN(Class1.java:458) at pkg2.ClassZ.methodUpdate(ClassZ.java:458) at … at java.lang.Thread.run(Thread.java:595)

Example 06:05: INFO (Class1.java:211) Start method2 06:05: INFO (Class1.java:211) Parameter ‘age’ is not an Integer 06:05: INFO (Class1.java:211) Finish method2 06:05: INFO (Class1.java:211) Start method2 06:05: DEBUG (Class1.java:220) Before retrieve information from DB 06:05: ERROR (Class1.java:243) Error retrieving information from DB: NullPointerException java.lang.NullPointerException at pkg.Class1.method2(Class1.java:225) at pkg.Class1.methodN(Class1.java:458) at pkg2.ClassZ.methodUpdate(ClassZ.java:458) at … at java.lang.Thread.run(Thread.java:595)

Where to log? Text files (Plain text, XML,…) Binary files Database Syslog (Windows & Unix/Linux) Network (TCP & UDP)

Where to log? Text files (Plain text, XML,…) Binary files Database Syslog (Windows & Unix/Linux) Network (TCP & UDP) Always to a Text file (+ something else)?

Performance "hidden" cost of parameter construction logger.debug("Entry number: " + i + " is " + String.valueOf(entry[i]));

Performance "hidden" cost of parameter construction logger.debug("Entry number: " + i + " is " + String.valueOf(entry[i])); Disable logging with options if (logger.isDebugEnabled()) { logger.debug("Entry number: " + i + " is " + String.valueOf(entry[i])); }

Multiple users (I) Different users working simultaneously Log messages mixed for different users Difficult to trace user’s actions

Multiple users (I) Different users working simultaneously Log messages mixed for different users Difficult to trace user’s actions Log User ID

Multiple users - Example 06:05: INFO (Class1.java:41) User=bfernan; message=‘Start method1’; 06:05: DEBUG (Class1.java:44) message=‘Before retrieve information from DB’; 06:05: DEBUG (Class1.java:46) message=‘After retrieve information from DB’; 06:05: INFO (Class1.java:50) message=‘Updating information’; 06:05: DEBUG (Class1.java:94) message=‘Before save information in the DB’; 06:05: DEBUG (Class1.java:96) message=‘After save information in the DB’; 06:05: INFO (Class1.java:100) User=bfernan; message=‘Finish method1’; 06:05: INFO (Class1.java:211) User=xxxxxxx; message=‘Start method2’; 06:05: DEBUG (Class1.java:220) message=‘Before retrieve information from DB’; 06:05: ERROR (Class1.java:243) message=‘Error retrieving information from DB: NullPointerException’;

Multiple users (II) Mapped Diagnostic Contexts (MDC) public void serviceMethod1(String userName,…) { String userName = getLoggedUserName(); MDC.put( “userName”, userName); } Configuration …PatternLayout=%T User=%X{userName};message=‘%m’;%n

Multiple users (III) public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; Principal principal = req.getUserPrincipal(); // Please note that we could have also used a cookie to // retrieve the user name if (principal != null) { String username = principal.getName(); MDC.put(USER_KEY, username); } try { chain.doFilter(request, response); } finally { MDC.remove(USER_KEY); } }

Multiple users (III) public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; Principal principal = req.getUserPrincipal(); // Please note that we could have also used a cookie to // retrieve the user name if (principal != null) { String username = principal.getName(); MDC.put(USER_KEY, username); } try { chain.doFilter(request, response); } finally { MDC.remove(USER_KEY); } }

Multiple users - Example 06:05: INFO (Class1.java:41) User=bfernan; message=‘Start method1’; 06:05: DEBUG (Class1.java:44) User=bfernan; message=‘Before retrieve information from DB’; 06:05: DEBUG (Class1.java:46) User=bfernan; message=‘After retrieve information from DB’; 06:05: INFO (Class1.java:50) User=bfernan; message=‘Updating information’; 06:05: DEBUG (Class1.java:94) User=bfernan; message=‘Before save information in the DB’; 06:05: DEBUG (Class1.java:96) User=bfernan; message=‘After retrieve information in the DB’; 06:05: INFO (Class1.java:100) User=bfernan; message=‘Finish method1’; 06:05: INFO (Class1.java:211) User=xxxxxxx; message=‘Start method2’; 06:05: DEBUG (Class1.java:220) User=xxxxxxx; message=‘Before retrieve information from DB’; 06:05: ERROR (Class1.java:243) User=xxxxxxx; message=‘Error retrieving information from DB: NullPointerException’ ;

Logging for Web Services What to log? Where the logs go to?

What to log? Platform Level Time and Memory Stamp and profiling tools Database access Queries and size of result Network incoming and outgoing traffic Requests and size of packets System software usages Parameters

What to log? Third Party Services Time stamp Parameters Size of responses

Where the logs go to? Log files Using virtual machine Databases Using data store services by the platform Web services Using a web service to show the logs

Summary Basic concepts Auditing, logging, and tracing Logging levels Multi-user logging Logging of web services