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

Disabling stdout and assert log in simulation setup #10467

Closed
AnHeuermann opened this issue Mar 29, 2023 · 8 comments · Fixed by #10500
Closed

Disabling stdout and assert log in simulation setup #10467

AnHeuermann opened this issue Mar 29, 2023 · 8 comments · Fixed by #10500
Assignees
Labels
COMP/GUI/OMEdit Issue and pull request related to OMEdit COMP/SimRT/C++ Issues and pull requests related to the C++ runtime
Milestone

Comments

@AnHeuermann
Copy link
Member

Description

In #10426 I wanted to disable all warnings as well as the stdout log in OMEdit.
I noticed, that the Logging section of the Simulation Setup->Simulation Flags doesn't show that stdout and assert are always active and you can't deactivate them by removing a tick (there is none, see attached screenshot).

I had to add -lv=-stdout to disable stdout log, but then got a warning, that -lv was specified twice:

stdout            | warning | Command line option 'lv' specified again. Value has been overriden from 'LOG_STATS' to '-stdout'. 

Steps to Reproduce

Open any model in OMEdit and open Simulation Setup->Simulation Flags.

Expected Behavior

  • Mark stdout and assert as active with a tick.
  • When removing the ticks add simulation flags -lv=-stdout or -lv=-assert.

Screenshots

grafik

Version and OS

  • OpenModelica Version: v1.21.0-dev-318-gd7cb3a8558 (64-bit)
  • OS: Windows 11
@AnHeuermann AnHeuermann added the COMP/GUI/OMEdit Issue and pull request related to OMEdit label Mar 29, 2023
adeas31 added a commit to adeas31/OpenModelica that referenced this issue Apr 4, 2023
Fixes OpenModelica#10467
Make the stdout and assert log options checked by default
When user unchecks then add -lv=-stdout
adeas31 added a commit that referenced this issue Apr 4, 2023
Fixes #10467
Make the stdout and assert log options checked by default
When user unchecks then add -lv=-stdout
@casella casella added this to the 1.22.0 milestone Apr 4, 2023
@rfranke
Copy link
Member

rfranke commented Apr 6, 2023

This breaks the C++ runtime. Any simulation fails now with:

Simulation stopped with error in model factory: log-settings flags not supported: stdout,assert,LOG_STATS  

The problem is that OMEdit settings had been identified with the prefix LOG_ so far. Bad that stdout and even more -stdout break this pattern.

Can't "stdout,assert," be omitted in the call args if the boxes stdout and assert are checked per default?

Nothing would mean that they are enabled. They can be disabled with -stdout,-assert. Currently C++ also fails when unchecking the boxes stdout and assert:

Simulation stopped with error in model factory: log-settings flags not supported: -stdout,-assert,LOG_STATS  

Meaning that currently there is no way to use the C++ runtime from OMEdit.

@rfranke rfranke reopened this Apr 6, 2023
@casella
Copy link
Contributor

casella commented Apr 7, 2023

@rfranke this does not affect the 1.21.0 release, right?

@rfranke
Copy link
Member

rfranke commented Apr 8, 2023

Yes, hopefully only a short living nuisance in the 1.22 dev branch.

Btw. internally the C runtime uses the same syntax with LOG_ prefix also for stdout and assert. Just the command line options have been changed to lower case and without prefix.

/* default activated, but it can be disabled with -stdout or -assert */
useStream[LOG_STDOUT] = 1;
useStream[LOG_ASSERT] = 1;
if(flags->find("LOG_ALL", 0) != string::npos)
{
for(i=1; i<SIM_LOG_MAX; ++i)
useStream[i] = 1;
}

The C++ runtime would understand --log-settings all=error to suppress anything but error messages -- this is the default setting.

@adeas31
Copy link
Member

adeas31 commented Apr 17, 2023

@AnHeuermann can you fix the stdout and assert logs to use the LOG_ prefix like others?

@AnHeuermann
Copy link
Member Author

You mean instead of -lv=assert using -lv=LOG_ASSERT?

@adeas31
Copy link
Member

adeas31 commented Apr 17, 2023

Yes

@AnHeuermann
Copy link
Member Author

@rfranke the location in the C runtime where we check if we have - in front of the log flags: https://github.com/OpenModelica/OpenModelica/blob/master/OMCompiler/SimulationRuntime/c/simulation/simulation_runtime.cpp#L179-L183

I guess you can add something similar for the C++ runtimein OMCFactory.cpp (I think).

rfranke added a commit to rfranke/OpenModelica that referenced this issue Apr 19, 2023
…10467

Support lists of log options for C++ as well, like
  --log-settings init=debug,nls=debug
or the equivalent
  --log-settings init,nls
to unify the syntax with OMEdit
  -lv LOG_INIT,LOG_NLS
Recognize disabled options, like -LOG_something.
Additionally turn error for any wrong log options to warning.
rfranke added a commit to rfranke/OpenModelica that referenced this issue Apr 19, 2023
…10467

Support lists of log options for C++ as well, like
  --log-settings init=debug,nls=debug
or the equivalent
  --log-settings init,nls
to unify the syntax with OMEdit
  -lv LOG_INIT,LOG_NLS
Recognize disabled options, like -LOG_something.
Additionally turn error for any wrong log options to warning.
rfranke added a commit that referenced this issue Apr 19, 2023
Support lists of log options for C++ as well, like
  --log-settings init=debug,nls=debug
or the equivalent
  --log-settings init,nls
to unify the syntax with OMEdit
  -lv LOG_INIT,LOG_NLS
Recognize disabled options, like -LOG_something.
Additionally turn error for any wrong log options to warning.
@rfranke
Copy link
Member

rfranke commented Apr 20, 2023

The above commits and 8006f5b fix it. Thank you @AnHeuermann and @adeas31.

@rfranke rfranke closed this as completed Apr 20, 2023
@casella casella added the COMP/SimRT/C++ Issues and pull requests related to the C++ runtime label Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMP/GUI/OMEdit Issue and pull request related to OMEdit COMP/SimRT/C++ Issues and pull requests related to the C++ runtime
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants