You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2014/09/04 19:07:30 UTC

Fwd: [1/5] git commit: Add IncompatibleLoggerException.

What about calling it ExtendedLoggerException because
IncompatibleLoggerException begs the question, incompatible with what
purpose, feature, widget?

We could also reuse UnsupportedOperationException.

Gary

---------- Forwarded message ----------
From: <ma...@apache.org>
Date: Thu, Sep 4, 2014 at 12:57 PM
Subject: [1/5] git commit: Add IncompatibleLoggerException.
To: commits@logging.apache.org


Repository: logging-log4j2
Updated Branches:
  refs/heads/master 501c6f1b7 -> 3faed6d42


Add IncompatibleLoggerException.


Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit:
http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/7f3bcce0
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/7f3bcce0
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/7f3bcce0

Branch: refs/heads/master
Commit: 7f3bcce08cbc87a319f653562543d69ccd5df2be
Parents: 657e5d5
Author: Matt Sicker <ma...@apache.org>
Authored: Thu Sep 4 11:25:51 2014 -0500
Committer: Matt Sicker <ma...@apache.org>
Committed: Thu Sep 4 11:56:49 2014 -0500

----------------------------------------------------------------------
 .../log4j/io/IncompatibleLoggerException.java   | 46 ++++++++++++++++++++
 1 file changed, 46 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f3bcce0/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/IncompatibleLoggerException.java
----------------------------------------------------------------------
diff --git
a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/IncompatibleLoggerException.java
b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/IncompatibleLoggerException.java
new file mode 100644
index 0000000..dad13fc
--- /dev/null
+++
b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/IncompatibleLoggerException.java
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache license, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the license for the specific language governing permissions and
+ * limitations under the license.
+ */
+package org.apache.logging.log4j.io;
+
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LoggingException;
+import org.apache.logging.log4j.spi.ExtendedLogger;
+
+/**
+ * Indicates that a provided {@link org.apache.logging.log4j.Logger} does
not implement {@link ExtendedLogger}.
+ *
+ * @since 2.1
+ */
+public class IncompatibleLoggerException extends LoggingException {
+
+    private static final long serialVersionUID = 6861427446876787666L;
+
+    /**
+     * Constructs a new IncompatibleLoggerException using the type of the
provided Logger. If {@code logger} is
+     * {@code null}, then the type is printed as "null". Note that this
exception should only be thrown in situations
+     * where a Logger was provided but did not implement ExtendedLogger.
+     *
+     * @param logger the provided Logger that was not an ExtendedLogger
+     */
+    public IncompatibleLoggerException(final Logger logger) {
+        super(
+            "Incompatible Logger class. Expected to implement " +
ExtendedLogger.class.getName() + ". Got: "
+                + (logger == null ? "null" : logger.getClass().getName())
+        );
+    }
+
+}




-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: [1/5] git commit: Add IncompatibleLoggerException.

Posted by Gary Gregory <ga...@gmail.com>.
I'd say reuse it as-is until there is a compelling use case for a custom
exception.

Gary


On Thu, Sep 4, 2014 at 1:11 PM, Matt Sicker <bo...@gmail.com> wrote:

> Extend UnsupportedOperationException? Or just throw that?
>
>
> On 4 September 2014 12:07, Gary Gregory <ga...@gmail.com> wrote:
>
>> What about calling it ExtendedLoggerException because
>> IncompatibleLoggerException begs the question, incompatible with what
>> purpose, feature, widget?
>>
>> We could also reuse UnsupportedOperationException.
>>
>> Gary
>>
>> ---------- Forwarded message ----------
>> From: <ma...@apache.org>
>> Date: Thu, Sep 4, 2014 at 12:57 PM
>> Subject: [1/5] git commit: Add IncompatibleLoggerException.
>> To: commits@logging.apache.org
>>
>>
>> Repository: logging-log4j2
>> Updated Branches:
>>   refs/heads/master 501c6f1b7 -> 3faed6d42
>>
>>
>> Add IncompatibleLoggerException.
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>> Commit:
>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/7f3bcce0
>> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/7f3bcce0
>> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/7f3bcce0
>>
>> Branch: refs/heads/master
>> Commit: 7f3bcce08cbc87a319f653562543d69ccd5df2be
>> Parents: 657e5d5
>> Author: Matt Sicker <ma...@apache.org>
>> Authored: Thu Sep 4 11:25:51 2014 -0500
>> Committer: Matt Sicker <ma...@apache.org>
>> Committed: Thu Sep 4 11:56:49 2014 -0500
>>
>> ----------------------------------------------------------------------
>>  .../log4j/io/IncompatibleLoggerException.java   | 46 ++++++++++++++++++++
>>  1 file changed, 46 insertions(+)
>> ----------------------------------------------------------------------
>>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f3bcce0/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/IncompatibleLoggerException.java
>> ----------------------------------------------------------------------
>> diff --git
>> a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/IncompatibleLoggerException.java
>> b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/IncompatibleLoggerException.java
>> new file mode 100644
>> index 0000000..dad13fc
>> --- /dev/null
>> +++
>> b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/IncompatibleLoggerException.java
>> @@ -0,0 +1,46 @@
>> +/*
>> + * Licensed to the Apache Software Foundation (ASF) under one or more
>> + * contributor license agreements. See the NOTICE file distributed with
>> + * this work for additional information regarding copyright ownership.
>> + * The ASF licenses this file to You under the Apache license, Version
>> 2.0
>> + * (the "License"); you may not use this file except in compliance with
>> + * the License. You may obtain a copy of the License at
>> + *
>> + *      http://www.apache.org/licenses/LICENSE-2.0
>> + *
>> + * Unless required by applicable law or agreed to in writing, software
>> + * distributed under the License is distributed on an "AS IS" BASIS,
>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>> implied.
>> + * See the license for the specific language governing permissions and
>> + * limitations under the license.
>> + */
>> +package org.apache.logging.log4j.io;
>> +
>> +import org.apache.logging.log4j.Logger;
>> +import org.apache.logging.log4j.LoggingException;
>> +import org.apache.logging.log4j.spi.ExtendedLogger;
>> +
>> +/**
>> + * Indicates that a provided {@link org.apache.logging.log4j.Logger}
>> does not implement {@link ExtendedLogger}.
>> + *
>> + * @since 2.1
>> + */
>> +public class IncompatibleLoggerException extends LoggingException {
>> +
>> +    private static final long serialVersionUID = 6861427446876787666L;
>> +
>> +    /**
>> +     * Constructs a new IncompatibleLoggerException using the type of
>> the provided Logger. If {@code logger} is
>> +     * {@code null}, then the type is printed as "null". Note that this
>> exception should only be thrown in situations
>> +     * where a Logger was provided but did not implement ExtendedLogger.
>> +     *
>> +     * @param logger the provided Logger that was not an ExtendedLogger
>> +     */
>> +    public IncompatibleLoggerException(final Logger logger) {
>> +        super(
>> +            "Incompatible Logger class. Expected to implement " +
>> ExtendedLogger.class.getName() + ". Got: "
>> +                + (logger == null ? "null" : logger.getClass().getName())
>> +        );
>> +    }
>> +
>> +}
>>
>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>



-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: [1/5] git commit: Add IncompatibleLoggerException.

Posted by Matt Sicker <bo...@gmail.com>.
Extend UnsupportedOperationException? Or just throw that?


On 4 September 2014 12:07, Gary Gregory <ga...@gmail.com> wrote:

> What about calling it ExtendedLoggerException because
> IncompatibleLoggerException begs the question, incompatible with what
> purpose, feature, widget?
>
> We could also reuse UnsupportedOperationException.
>
> Gary
>
> ---------- Forwarded message ----------
> From: <ma...@apache.org>
> Date: Thu, Sep 4, 2014 at 12:57 PM
> Subject: [1/5] git commit: Add IncompatibleLoggerException.
> To: commits@logging.apache.org
>
>
> Repository: logging-log4j2
> Updated Branches:
>   refs/heads/master 501c6f1b7 -> 3faed6d42
>
>
> Add IncompatibleLoggerException.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> Commit:
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/7f3bcce0
> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/7f3bcce0
> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/7f3bcce0
>
> Branch: refs/heads/master
> Commit: 7f3bcce08cbc87a319f653562543d69ccd5df2be
> Parents: 657e5d5
> Author: Matt Sicker <ma...@apache.org>
> Authored: Thu Sep 4 11:25:51 2014 -0500
> Committer: Matt Sicker <ma...@apache.org>
> Committed: Thu Sep 4 11:56:49 2014 -0500
>
> ----------------------------------------------------------------------
>  .../log4j/io/IncompatibleLoggerException.java   | 46 ++++++++++++++++++++
>  1 file changed, 46 insertions(+)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/7f3bcce0/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/IncompatibleLoggerException.java
> ----------------------------------------------------------------------
> diff --git
> a/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/IncompatibleLoggerException.java
> b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/IncompatibleLoggerException.java
> new file mode 100644
> index 0000000..dad13fc
> --- /dev/null
> +++
> b/log4j-iostreams/src/main/java/org/apache/logging/log4j/io/IncompatibleLoggerException.java
> @@ -0,0 +1,46 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one or more
> + * contributor license agreements. See the NOTICE file distributed with
> + * this work for additional information regarding copyright ownership.
> + * The ASF licenses this file to You under the Apache license, Version 2.0
> + * (the "License"); you may not use this file except in compliance with
> + * the License. You may obtain a copy of the License at
> + *
> + *      http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing, software
> + * distributed under the License is distributed on an "AS IS" BASIS,
> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> + * See the license for the specific language governing permissions and
> + * limitations under the license.
> + */
> +package org.apache.logging.log4j.io;
> +
> +import org.apache.logging.log4j.Logger;
> +import org.apache.logging.log4j.LoggingException;
> +import org.apache.logging.log4j.spi.ExtendedLogger;
> +
> +/**
> + * Indicates that a provided {@link org.apache.logging.log4j.Logger} does
> not implement {@link ExtendedLogger}.
> + *
> + * @since 2.1
> + */
> +public class IncompatibleLoggerException extends LoggingException {
> +
> +    private static final long serialVersionUID = 6861427446876787666L;
> +
> +    /**
> +     * Constructs a new IncompatibleLoggerException using the type of the
> provided Logger. If {@code logger} is
> +     * {@code null}, then the type is printed as "null". Note that this
> exception should only be thrown in situations
> +     * where a Logger was provided but did not implement ExtendedLogger.
> +     *
> +     * @param logger the provided Logger that was not an ExtendedLogger
> +     */
> +    public IncompatibleLoggerException(final Logger logger) {
> +        super(
> +            "Incompatible Logger class. Expected to implement " +
> ExtendedLogger.class.getName() + ". Got: "
> +                + (logger == null ? "null" : logger.getClass().getName())
> +        );
> +    }
> +
> +}
>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>



-- 
Matt Sicker <bo...@gmail.com>