Ok, big merge. here's the new xml-config stuff in action. There's a few
[mir.git] / source / mir / misc / Logfile.java
index 2589e98..1775ab4 100755 (executable)
@@ -23,6 +23,11 @@ public final class Logfile {
                private RandomAccessFile raf;
                private String fileName;
 
+        //config var, required since it's "null"
+        //TODO: should have a defaul value once I figure out 
+        //how to disperse home dir. -mh
+        private static String logDir="/tmp/";
+
        /**
         * lineSeparator ermitteln und Repository anlegen
         */
@@ -41,6 +46,7 @@ public final class Logfile {
         * @return Logfile
         */
                public static Logfile getInstance(String fileName) {
+            //TODO: tokenize the CallerClass name (fileName)
                        Logfile returnLogfile = null;
                        System.err.println(fileName);
                        if (fileName != null) {
@@ -49,6 +55,8 @@ public final class Logfile {
                                } else {
                                        returnLogfile = new Logfile(fileName);
                                        instanceRepository.put(fileName, returnLogfile);
+                    Integer i = new Integer(instanceRepository.size());
+                    System.err.println("SIZZE: "+i.toString());
                                }
                        } else {
                                System.err.println("Fehler bei Instantiierung von Logfile");
@@ -60,10 +68,11 @@ public final class Logfile {
         * Privater Konstruktor
         * @param   String fileName
         */
-               private Logfile(String fileName){
-                       this.fileName = fileName;
+               private Logfile(String file){
+                       this.fileName = logDir+file;
+                       System.err.println("FILENAME "+fileName+"DD");
                        try {
-                               File f = new File(fileName);
+                               File f = new File(this.fileName);
                                File dir = new File(f.getParent());
                                dir.mkdirs();
                                raf = new RandomAccessFile(fileName, "rw");
@@ -72,6 +81,13 @@ public final class Logfile {
                        }
                }
 
+        //TODO: should have a defaul value once I figure out 
+        //how to disperse home dir. -mh
+        public static void setLogDir(String dir) {
+            logDir=StringUtil.addSeparator(dir);
+                       System.err.println("set logDir "+logDir);
+        }
+
        /**
         * Private Methode, um eine Zeile auszugeben
         *