katstack commented on code in PR #4234: URL: https://github.com/apache/logging-log4j2/pull/4234#discussion_r4360569763
########## log4j-core/src/main/java/org/apache/logging/log4j/core/appender/rolling/action/AbstractCompressAction.java: ########## @@ -0,0 +1,105 @@ +/* + * 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.core.appender.rolling.action; + +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.util.Objects; +import org.apache.logging.log4j.core.appender.rolling.action.internal.CompressActionSupport; + +/** + * Base class for actions that compress a file and optionally delete the source after successful compression. + * + * @since 2.27.0 + */ +public abstract class AbstractCompressAction extends AbstractAction { + + /** Buffer size used when copying source data to the compressor. */ + protected static final int BUF_SIZE = 8192; + + /** Source file. */ + protected final File source; + /** Destination file. */ + protected final File destination; + /** If true, attempt to delete the source file after successful compression. */ + protected final boolean deleteSource; + + private final String compressionName; + + /** + * Creates a compression action without start and finish debug messages. + * + * @param source file to compress, must not be null + * @param destination compressed file, must not be null + * @param deleteSource whether to delete the source after successful compression + */ + protected AbstractCompressAction(final File source, final File destination, final boolean deleteSource) { + this(source, destination, deleteSource, null); Review Comment: Removed the constructor without a compression name. All implementations now pass `compressionName`, and the null checks in the logging path are gone. Addressed in fe12eb5f1d. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
