Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ml.neoforex;
- import java.util.Properties;
- /*
- * NeoForex 2015.
- * Only for NeoForex projects.
- * Programmer Name: Daniel Hurtado(Forex) Email: forest_project@hotmail.es/forex.neoforex.ml
- * Contact to Programmer for report bugs/Error's.
- */
- public class Logger {
- // Vars with default values.
- private boolean isEnable = false;
- private boolean fileLogEnable = true;
- private String fileSaveFolder = "logs";
- // Class information
- private Class<?> savedClass;
- private String className = "";
- // System properties
- private Properties systemProperties;
- // Get vars for JVM..
- public Logger(Class<?> classInfo) {
- // Get System Properties...
- systemProperties = System.getProperties();
- // Get default properties...
- this.isEnable = Boolean.parseBoolean(systemProperties.getProperty("ml.neoforex.sockets.consoleEnable"));
- this.fileLogEnable = Boolean.parseBoolean(systemProperties.getProperty("ml.neoforex.sockets.fileLogEnable"));
- // Set Logger url
- if(this.fileLogEnable) {
- if(!this.fileSaveFolder.equals(systemProperties.getProperty("ml.neoforex.sockets.fileSaveFolder"))) {
- this.fileSaveFolder = systemProperties.getProperty("ml.neoforex.sockets.fileSaveFolder");
- }
- }
- // Get the className and save class...
- this.savedClass = classInfo;
- this.className = classInfo.getCanonicalName();
- }
- // This void is called by the gc.
- protected void finalize() {
- // Remove all.
- this.isEnable = false;
- this.fileLogEnable = false;
- this.fileSaveFolder = null;
- this.className = null;
- this.systemProperties = null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement