Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2013 - 2015, Neemworks Nigeria <dev@nimworks.com>
   Permission to use, copy, modify, and distribute this software for any
   purpose with or without fee is hereby granted, provided that the above
   copyright notice and this permission notice appear in all copies.
  
   THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
   WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
   MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 package nw.commons;
 
 
Base class that includes logger and property file access

Author(s):
Ogwara O. Rowland
Version:
0.2
Since:
10th November, 2013
 
 public abstract class NeemClazz {

    
simple slf4j logger.
 
     protected Logger logger = LoggerFactory.getLogger(getClass());

    
Enables or disables debug mode on.
 
     private static boolean debugModeOn;

    
Property file name
 
     private String targetPropertyFilename = "application.properties";

    
Default Properties file manipulations (application.properties)
 
     protected AppProperties appProps;

    
Initialization
 
     public NeemClazz(){
     	 = PropertiesCache.getPropertyFile(getTargetPropertyFilename());
     }


    
Debug.

Parameters:
msg the msg
 
     public void debug(String msg){
     	if(isDebugModeOn()){
     		.debug(msg);
     	}
     }

    
static debug logging.

Parameters:
clz class to be debugged
msg message to log
 
     protected static void sd(Class<? extends NeemClazzclzString msg){
     	LoggerFactory.getLogger(clz).debug(msg);
     }

    
static info logging.

Parameters:
clz class to be debugged
msg message to log
 
     protected static void si(Class<? extends NeemClazzclzString msg){
     	LoggerFactory.getLogger(clz).info(msg);
     }

    
static trace logging.

Parameters:
clz class to be debugged
msg message to log
 
     protected static void st(Class<? extends NeemClazzclzString msg){
     	LoggerFactory.getLogger(clz).trace(msg);
     }

    
static warn logging.

Parameters:
clz class to be logged
msg message to log
t exception to log
    protected static void sd(Class<? extends NeemClazzclzString msgThrowable t){
    	LoggerFactory.getLogger(clz).warn(msgt);
    }

    
static error logging.

Parameters:
clz class to be logged
msg message to log
t exception to log
    protected static void se(Class<? extends NeemClazzclzString msgThrowable t){
    	LoggerFactory.getLogger(clz).error(msgt);
    }

Checks if is debug mode on.

Returns:
true, if is debug mode on
	public boolean isDebugModeOn() {
		return ;
	}

Sets the debug mode on.

Parameters:
debugModeOn the new debug mode on
	public void setDebugModeOn(boolean debugModeOn) {
		. = debugModeOn;
	}
	}
	public void setTargetPropertyFilename(String targetPropertyFilename) {
		this. = targetPropertyFilename;
	}
New to GrepCode? Check out our FAQ X