On Oct 10, 2012, at 10:00 AM, Gary Gregory wrote:

> Done as getLogger(Object).
> 
> Here is another one:
> 
>     public SocketServer(int port) throws IOException {
>         server = new ServerSocket(port);
>         if (logger == null) {
>             logger = LogManager.getLogger(getClass().getName(), port);
>         }
>     }
> 
> Where:
> 
>     /**
>      * Returns a Logger with the name built from the given values. For 
> example:
>      * 
>      * <pre>
>      * getLogger("a", "b", "c") = a Logger named "a.b.c"
>      * getLogger(getClass().getName(), portNumber) = a Logger named 
> "com.foo.http.80"</pre>
>      * 
>      * @param values
>      *            The logger name values.
>      * @return The Logger.
>      */
>     public static Logger getLogger(final Object... values) {
>     ...
>     }
> 
> The trick is that to test this, I had to do:
> 
>     @Test
>     public void getLoggerByObjectArray() {
>         Logger classLogger = LogManager.getLogger(getClass().getName() + 
> ".80");
>         assertEquals(classLogger, LogManager.getLogger(LoggerTest.class, 80));
>     }
> 
> Because Logger has no getName() API? How can that be?

How can that be? Not a clue. Obviously, that is an error.

Ralph
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to