Tuesday, 29 March 2016

Jboss - logging

Standalone Mode server logging : 
Documents\vamsi\EAP-6.4.0\standalone\log\server.log


Domain Mode server logging : 

You will find domain mode logging in domain install directory.
Documents\vamsi\DC_replica\hc1\servers\server-one\log\server.log
Documents\vamsi\DC_replica\hc2\servers\server-one\log\server.log

Following are the different log levels jboss supports.


  1. fatal
  2. error
  3. warn 
  4. info
  5. debug
  6. trace
Documents\vamsi\DC_replica\hc1\log\host-controller.log  -Host related failures 'll be recorded here.
Documents\vamsi\DC_replica\hc1\log\process-controller.log   - OS related failures 'll be recorded here.


12:04:09,797 INFO  [org.jboss.as.connector.deployment] (MSC service thread 1-5) JBAS010401: Bound JCA ConnectionFactory [java:/JmsXA]

12:04:09,813 INFO  [org.hornetq.core.server] (ServerService Thread Pool -- 66) HQ221003: trying to deploy queue jms.queue.DLQ
12:04:09,797 ERROR [org.hornetq.core.server] (Old I/O server worker (parentId: -1436309681, [id: 0xaa63a74f, /192.168.1.208:5595])) HQ224018: Failed to create session: HornetQException[errorType=CLUSTER_SECURITY_EXCEPTION message=HQ119099: Unable to authenticate cluster user: HORNETQ.CLUSTER.ADMIN.USER]
at org.hornetq.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:123) [hornetq-server-2.3.25.Final-redhat-1.jar:2.3.25.Final-redhat-1]
at org.hornetq.core.server.impl.HornetQServerImpl.createSession(HornetQServerImpl.java:980) [hornetq-server-2.3.25.Final-redhat-1.jar:2.3.25.Final-redhat-1]



Logging subsystem:

Handlers:

  1. Console handler
  2. File Handler
  3. Size rotating file handler
  4. Time based
  5. Asynchronous file handler




Create a Log Category and assign a file handler to it.





   
 package com.optum.jboss.log;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Servlet implementation class OptumLogServlet
 */
@WebServlet("/OptumLogServlet")
public class OptumLogServlet extends HttpServlet {
 private static final long serialVersionUID = 1L;
 
 private static final Log log = LogFactory.getLog(OptumLogServlet.class);
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public OptumLogServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

 /**
  * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
  */
 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  // TODO Auto-generated method stub
  
  response.getWriter().append("served at: ").append(request.getContextPath());
  
  PrintWriter out = response.getWriter();
  out.write("writing logs in com.optum.logtest directory");
  out.close();
  
  log.debug("It's debug logging");
  log.fatal("It's a fatal logging");
  log.error("It's a error logging");
  log.warn("It's a warn logging");
  log.info("It's a info logging");
 }

 /**
  * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
  */
 protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  // TODO Auto-generated method stub
 }

}
 



No comments:

Post a Comment