Advertisement
forextheblack

Untitled

Jul 3rd, 2015
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.60 KB | None | 0 0
  1. package ml.neoforex;
  2.  
  3. import java.util.Properties;
  4.  
  5.     /*
  6.      * NeoForex 2015.
  7.      * Only for NeoForex projects.
  8.      * Programmer Name: Daniel Hurtado(Forex) Email: forest_project@hotmail.es/forex.neoforex.ml
  9.      * Contact to Programmer for report bugs/Error's.
  10.      */
  11. public class Logger {
  12.     // Vars with default values.
  13.     private boolean isEnable = false;
  14.     private boolean fileLogEnable = true;
  15.     private String fileSaveFolder = "logs";
  16.    
  17.     // Class information
  18.     private Class<?> savedClass;
  19.     private String className = "";
  20.    
  21.     // System properties
  22.     private Properties systemProperties;
  23.    
  24.     // Get vars for JVM..
  25.     public Logger(Class<?> classInfo) {
  26.         // Get System Properties...
  27.         systemProperties = System.getProperties();
  28.        
  29.         // Get default properties...
  30.         this.isEnable = Boolean.parseBoolean(systemProperties.getProperty("ml.neoforex.sockets.consoleEnable"));
  31.         this.fileLogEnable = Boolean.parseBoolean(systemProperties.getProperty("ml.neoforex.sockets.fileLogEnable"));
  32.        
  33.         // Set Logger url
  34.         if(this.fileLogEnable) {
  35.             if(!this.fileSaveFolder.equals(systemProperties.getProperty("ml.neoforex.sockets.fileSaveFolder"))) {
  36.                 this.fileSaveFolder = systemProperties.getProperty("ml.neoforex.sockets.fileSaveFolder");
  37.             }
  38.         }
  39.        
  40.         // Get the className and save class...
  41.         this.savedClass = classInfo;
  42.         this.className = classInfo.getCanonicalName();
  43.     }
  44.    
  45.    
  46.     // This void is called by the gc.
  47.     protected void finalize() {
  48.         // Remove all.
  49.         this.isEnable = false;
  50.         this.fileLogEnable = false;
  51.         this.fileSaveFolder = null;
  52.         this.className = null;
  53.         this.systemProperties = null;
  54.     }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement