Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use Plog with Crontab in Linux #240

Open
HanshengGUO opened this issue Feb 21, 2023 · 2 comments
Open

Cannot use Plog with Crontab in Linux #240

HanshengGUO opened this issue Feb 21, 2023 · 2 comments
Labels

Comments

@HanshengGUO
Copy link

Hi,

I'm trying to use plog in my project and I need to use Crontab for scheduled automatic start. Here is my code

time_t t = time(0); 
char filename[100];
// The position for log file
strftime(filename, sizeof(filename), "/root/work/Lipschitz-future/iTradeDemo_Linux/log/%Y-%m-%d-%H:%M:%S.log",localtime(&t));
static plog::RollingFileAppender<plog::CsvFormatter> fileAppender(filename, 1000000, 5);
static plog::ConsoleAppender<plog::TxtFormatter> consoleAppender;
// Set 2 appenders to output to console and log file at same time
plog::init(plog::debug, &fileAppender).addAppender(&consoleAppender);

And I use Crontab to start it at a specific time. But the output is just one line (my program should output several lines) and then the program terminated.

Date;Time;Severity;TID;This;Function;Message
2023/02/21;20:01:03.038;INFO;26031;0;main@31;"Version iTapTradeAPI V9.3.2.1, Date 2019.9.17"

Would you please help me how I can use Plog and Crontab together?

@SergiusTheBest
Copy link
Owner

Hi!

Could you post the lines where do you write messages to the log?

@SergiusTheBest
Copy link
Owner

@HanshengGUO any updates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants