On Wed, Oct 10, 2012 at 6:39 PM, Ralph Goers <[email protected]>wrote:
>
> 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.
>
Ok, I added Logger.getName(), please code review.
Gary
>
> Ralph
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
--
E-Mail: [email protected] | [email protected]
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory