[ 
https://issues.apache.org/jira/browse/FLINK-10441?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16643667#comment-16643667
 ] 

Guibo Pan commented on FLINK-10441:
-----------------------------------

In RestServerEndpoint#createUploadDir, it seems that the uploadDir is checked 
twice currently.
{code:java}
/**
 * Creates the upload dir if needed. 
*/ 
@VisibleForTesting 
static void createUploadDir(final Path uploadDir, final Logger log) throws 
IOException { 
    if (!Files.exists(uploadDir)) { 
        log.warn("Upload directory {} does not exist, or has been deleted 
externally. " + "Previously uploaded files are no longer available.", 
uploadDir); checkAndCreateUploadDir(uploadDir, log); 
    } 
} 
 
/**
 * Checks whether the given directory exists and is writable. If it doesn't 
exist, this method
 * will attempt to create it.
 *
 * @param uploadDir directory to check
 * @param log logger used for logging output
 * @throws IOException if the directory does not exist and cannot be created, 
or if the * directory isn't writable
 */
 private static synchronized void checkAndCreateUploadDir(final Path uploadDir, 
final Logger log) throws IOException {
    if (Files.exists(uploadDir) && Files.isWritable(uploadDir)) {
        log.info("Using directory {} for file uploads.", uploadDir);
    } else if (Files.isWritable(Files.createDirectories(uploadDir))) {
        log.info("Created directory {} for file uploads.", uploadDir); 
    } else {
        log.warn("Upload directory {} cannot be created or is not writable.", 
uploadDir);
        throw new IOException( String.format("Upload directory %s cannot be 
created or is not writable.", uploadDir));
    }
 }
{code}
It looks ok to directly remove the warning log.

Thanks.

> Don't log warning when creating upload directory
> ------------------------------------------------
>
>                 Key: FLINK-10441
>                 URL: https://issues.apache.org/jira/browse/FLINK-10441
>             Project: Flink
>          Issue Type: Improvement
>          Components: REST
>            Reporter: Ufuk Celebi
>            Priority: Minor
>
> {{RestServerEndpoint.createUploadDir(Path, Logger)}} logs a warning if the 
> upload directory does not exist.
> {code}
> 2018-09-26 15:32:31,732 WARN  
> org.apache.flink.runtime.dispatcher.DispatcherRestEndpoint    - Upload 
> directory 
> /var/folders/hr/cxn1_2y52qxf5nzyfq9h2scw0000gn/T/flink-web-2218b898-f245-4edf-b181-8f3bdc6014f3/flink-web-upload
>  does not exist, or has been deleted externally. Previously uploaded files 
> are no longer available.
> {code}
> I found this warning confusing as it is always logged when relying on the 
> default configuration (via {{WebOptions}}) that picks a random directory.
> Ideally, our default configurations should not result in warnings to be 
> logged.
> Therefore, I propose to log the creation of the web directory on {{INFO}} 
> instead of the warning.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to