how to restrict object creation with certain dependency injection?
<p>I am creating custom logging functionalities class that internally uses the LOG4j. those classes that wants to used logging functionalities,it pass the name of class.i want to know how i am able to restrict object creation without passing the class-name to it.i tried but i am not sure that Is it a correct way i did?</p>

<pre>

public class LoggerObject 
{
    private Logger logger;
    private static LoggerObject loggerobj;
    private ConstantDataManager constantdatamanger;

    //Default Log4J_FILE Path
    private LoggerObject(String className)
    {
      try
      {
        DOMConfigurator.configure(this.getClass().getClassLoader().getResource(constantdatamanger.LOG4J_FILE));
        logger =Logger.getLogger(className);
       }
      catch(Exception ex)
      {
          System.out.println("DOMConfigurator could not find file"+ex.getMessage());
      }
    }

     public static LoggerObject getLogger(String className)
        {
            if (loggerobj==null)
            {
             loggerobj = new LoggerObject(className);
            }
             return loggerobj;
        }


    public void info(Object message)
    {
        logger.info(message);
    }

    public void info(Object message, Throwable t) {
        logger.info(message, t);
    }

    public void error(Object message) {
         logger.error(message);
    }

    public void error(Object message, Throwable t) {
       logger.error(message,t);
    }

    public void debug(Object message) {
       logger.debug(message);
    }

    public void debug(Object message, Throwable t) {
        logger.debug(message,t);
    }

    public void warn(Object message) {
       logger.warn(message);
    }

    public void warn(Object message, Throwable t) {
       logger.warn(message,t);
    }

    public void fatal(Object message) {
       logger.fatal(message);
    }

    public void fatal(Object message, Throwable t) {
        logger.fatal(message,t);
    }
</pre>

<p>Thanks</p>
