nguyenbahuong / smslib

Automatically exported from code.google.com/p/smslib
0 stars 0 forks source link

It is not possible to implement their own logging facility #468

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It is not possible to implement their own logging facility. It would be useful 
when the server was built would be part of another server, eg "JBoss".

Original issue reported on code.google.com by Waldemar.Klaczynski on 7 Mar 2012 at 7:02

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Perhaps add a small change in class Logger:

--- 
/opt/Projekty/Google/sms-lib/sms-lib/src/main/java/org/smslib/helper/Logger.java
+++ 
/opt/Projekty/JBoss/wklaczynski/jboss-sms/sms-lib/src/main/java/org/smslib/helpe
r/Logger.java
@@ -26,13 +26,13 @@

 public class Logger
 {
-   private static final Logger logger = new Logger();
+   private static Logger logger = new Logger();

    org.apache.log4j.Logger log4jLogger;

    private static final String FQCN = Logger.class.getName();

-   private Logger()
+   protected Logger()
    {
        if (System.getProperties().getProperty("java.vm.name").equalsIgnoreCase("ikvm.net"))
        {
@@ -53,9 +53,17 @@

    public static Logger getInstance()
    {
+            if(Logger.logger == null){
+                Logger.logger = new Logger();
+            }    
        return Logger.logger;
    }

+   public static void setInstance(Logger logger)
+   {
+       Logger.logger = logger;
+   }
+        
    public void logInfo(String message, Exception e, String gatewayId)
    {
        if (log4jLogger == null) return;

Original comment by Waldemar.Klaczynski on 7 Mar 2012 at 7:20

GoogleCodeExporter commented 9 years ago

Original comment by T.Delenikas on 7 Mar 2012 at 9:20

GoogleCodeExporter commented 9 years ago
r2331

Original comment by T.Delenikas on 9 Mar 2012 at 9:08

GoogleCodeExporter commented 9 years ago

Original comment by T.Delenikas on 31 Mar 2012 at 8:03