Skip to content

Commit

Permalink
KAFKA-5609: Connect log4j should also log to a file by default (KIP-5…
Browse files Browse the repository at this point in the history
…21) (apache#7430)

Implemented KIP-521 to change the provided Connect Log4J configuration file to also write logs to files and to rotate them daily.

Author: Konstantine Karantasis <[email protected]>
Reviewer: Randall Hauch <[email protected]>
  • Loading branch information
kkonstantine authored and rhauch committed Oct 2, 2019
1 parent 1c831c2 commit 16edc54
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions config/connect-log4j.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,31 @@
# See the License for the specific language governing permissions and
# limitations under the License.

log4j.rootLogger=INFO, stdout

log4j.rootLogger=INFO, stdout, connectAppender

# Send the logs to the console.
#
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Send the logs to a file, rolling the file at midnight local time. For example, the `File` option specifies the
# location of the log files (e.g. ${kafka.logs.dir}/connect.log), and at midnight local time the file is closed
# and copied in the same directory but with a filename that ends in the `DatePattern` option.
#
log4j.appender.connectAppender=org.apache.log4j.DailyRollingFileAppender
log4j.appender.connectAppender.DatePattern='.'yyyy-MM-dd-HH
log4j.appender.connectAppender.File=${kafka.logs.dir}/connect.log
log4j.appender.connectAppender.layout=org.apache.log4j.PatternLayout

# The `%X{connector.context}` parameter in the layout includes connector-specific and task-specific information
# in the log message, where appropriate. This makes it easier to identify those log messages that apply to a
# specific connector. Simply add this parameter to the log layout configuration below to include the contextual information.
#
#log4j.appender.stdout.layout.ConversionPattern=[%d] %p %X{connector.context}%m (%c:%L)%n
log4j.appender.stdout.layout.ConversionPattern=[%d] %p %m (%c:%L)%n
connect.log.pattern=[%d] %p %m (%c:%L)%n
#connect.log.pattern=[%d] %p %X{connector.context}%m (%c:%L)%n

log4j.appender.stdout.layout.ConversionPattern=${connect.log.pattern}
log4j.appender.connectAppender.layout.ConversionPattern=${connect.log.pattern}

log4j.logger.org.apache.zookeeper=ERROR
log4j.logger.org.reflections=ERROR

0 comments on commit 16edc54

Please sign in to comment.