From fa7faee63358e1c5518395b73433d5af285177a1 Mon Sep 17 00:00:00 2001 From: Valera Cogut Date: Mon, 24 Sep 2018 22:09:22 +0300 Subject: [PATCH] fc::create_directories before rotate_files --- src/log/file_appender.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/log/file_appender.cpp b/src/log/file_appender.cpp index feeea62..34a63a8 100644 --- a/src/log/file_appender.cpp +++ b/src/log/file_appender.cpp @@ -34,20 +34,19 @@ namespace fc { public: impl( const config& c) : cfg( c ) { - if( cfg.rotate ) - { - FC_ASSERT( cfg.rotation_interval >= seconds( 1 ) ); - FC_ASSERT( cfg.rotation_limit >= cfg.rotation_interval ); - - rotate_files( true ); - } - try { fc::create_directories(cfg.filename.parent_path()); - if(!cfg.rotate) + if( cfg.rotate ) + { + FC_ASSERT( cfg.rotation_interval >= seconds( 1 ) ); + FC_ASSERT( cfg.rotation_limit >= cfg.rotation_interval ); + + rotate_files( true ); + } else { out.open( cfg.filename, std::ios_base::out | std::ios_base::app); + } } catch( ... ) {