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

logging adjustments #68

Open
GitMensch opened this issue Jun 27, 2022 · 7 comments
Open

logging adjustments #68

GitMensch opened this issue Jun 27, 2022 · 7 comments

Comments

@GitMensch
Copy link
Contributor

This is a follow-up to #15.


From https://github.com/gabime/spdlog I see

Various log targets:

  • Rotating log files.
  • Daily log files.
  • Console logging (colors supported).
  • syslog.
  • Windows event log.

Which one was used for your performance tests? Is it configurable at run-time which logger to use?

Originally posted by @GitMensch in #15 (comment)

I have used the “null sink” when the log level is set to “off”, and the basic_file_sink_mt in all the other cases. The setup of the logger is done when the library is loaded and, for now, it’s fixed, but it might be changed quite easily in the future (level and output file can be set with environment variables).

Originally posted by @mridoni in #15 (comment)


So this FR is about:

  • add configurable log targets
  • recheck if the install instructions need the spdlog dependency added (on CentOS8 it is named spdlog-devel)
  • for GIXSQL_DEBUG_LOG_FILE: automatically replace $$ in the name with the process' PID (GnuCOBOL does this on opening its warning/trace/error files and that feature is quite handy [also works on Windows])
  • consider changing the default of GIXSQL_DEBUG_LOG_LEVEL from "off" to "error"
  • consider renaming env vars:
    • GIXSQL_DEBUG_LOG_FILE->GIXSQL_LOG or GIXSQL_LOG_FILE
    • GIXSQL_DEBUG_LOG_LEVEL to GIXSQL_LOG_LEVEL
@mridoni
Copy link
Owner

mridoni commented Aug 2, 2022

Except for the first point (add configurable log targets), all of this has been implemented in the internal repository. For consistency I have used - in the documentation - the package names from Ubuntu 20.04 and added fmt-devel, that is also needed sice spdlog relies on it).

mridoni added a commit that referenced this issue Aug 15, 2022
This is a maintenance pre-release for GixSQL. It fixes a few issues and adds two new databases drivers (Oracle and SQLite). The next "standard" release (presumably v1.0.18) will have feature parity for all database drivers.

- Added new Oracle driver, based on ODPI
- Added new SQLite driver
- Solution for "PG: issue with prepared statements" (#99)
- Solution for "PCursors cannot be re-opened after close" (#98)
- Solution for "libgixpp: setStatus is called for errors without DBI parm passed - sets SQLERRM" (#94)
- Solution for "error handling (especially for 07001)" (#92)
- Solution for "show-stopper bug in pgsql_prepare" (#91)
- Solution for "PREPARE does not work with VARLENGTH groups (ocesql compat)" (#79)
- Partial solution for "PREPARE does not work with VARLENGTH groups (ocesql compat)" (#68)
- Solution for "The PostgreSQL driver needs START TRANSACTION before using cursors" (#14)
- Solution for "FR: support EXEC SQL VAR" (#21)
- Fixed a bug in "problems with "codegen / logic issue for "GIXSQLCursorDeclareParams" (#88)
- Fixed COMP-3 handling in drivers other than PostgreSQL
- Rewrote the test suite (still MSTest-based) to dynamically generate a matrix of test to be run on the various platforms/database drivers
@GitMensch
Copy link
Contributor Author

Sounds good. Should we move the configurable log targets out to a different issue (reasonable if you don't intend to add it to the upcoming release version, which I think is the case)?

When you get to that part: configurable to "stderr" is possibly most easy and most requested (and may be even a reasonable default).

@GitMensch
Copy link
Contributor Author

One thing to definitely fix (seems to be new in 1.0.18dev2):

$> startcob.sh
terminate called after throwing an instance of 'spdlog::spdlog_ex'
  what():  Failed opening file gixsql.log for writing: Permission denied
startcob.sh: line 261: 1130671 Aborted                 (core dumped) cobcrun PROG

@GitMensch
Copy link
Contributor Author

The log is full of " [libgixsql] [error] No data" - are you sure "error" is the correct log level? Shouldn't it be trace / verbose?

@mridoni
Copy link
Owner

mridoni commented Aug 17, 2022

The log is full of " [libgixsql] [error] No data" - are you sure "error" is the correct log level? Shouldn't it be trace / verbose?

You're right, I will fix it

@mridoni
Copy link
Owner

mridoni commented Aug 17, 2022

The log is full of " [libgixsql] [error] No data" - are you sure "error" is the correct log level? Shouldn't it be trace / verbose?

You're right, I will fix it

Fixed in the internal repository, will be included in the release

mridoni added a commit that referenced this issue Aug 23, 2022
- Added new Oracle driver, based on ODPI
- Added new SQLite driver
- All the drivers have been updated and now implement the complete set of supported features
- Solution for "PG: issue with prepared statements" (#99)
- Solution for "PCursors cannot be re-opened after close" (#98)
- Solution for "libgixpp: setStatus is called for errors without DBI parm passed - sets SQLERRM" (#94)
- Solution for "error handling (especially for 07001)" (#92)
- Solution for "show-stopper bug in pgsql_prepare" (#91)
- Solution for "PREPARE does not work with VARLENGTH groups (ocesql compat)" (#79)
- Partial solution for "PREPARE does not work with VARLENGTH groups (ocesql compat)" (#68)
- Solution for "The PostgreSQL driver needs START TRANSACTION before using cursors" (#14)
- Solution for "FR: support EXEC SQL VAR" (#21)
- Fixed a bug in "problems with "codegen / logic issue for "GIXSQLCursorDeclareParams" (#88)
- Solution for "FR: allow mapping of "NoRecCode"' (#95) - added --no-rec-code parameter to gixpp
- Tokens in the parser have been labeled to improve diagnostics (pulled PR #96 by @GitMensch)
- Fixed COMP-3 handling in drivers other than PostgreSQL
- Rewrote the test suite (still MSTest-based) to dynamically generate a matrix of test to be run on the various platforms/database drivers
- Added options for parameter generation in gixpp (-a was removed)
- Added new GIXSQL_FIXUP_PARAMS option for runtime, to automatically convert parameter format in prepared statments
- "Native" cursors are now the default for the PostgreSQL driver
- "Smart" cursor initialization is now the default for all cursors, including those declared in WORKING-STORAGE (-L was removed from gixpp), should fix #101
- Removed dynamic cursor emulation from the ODBC driver when using PostgreSQL
@mridoni mridoni removed the ready label Aug 24, 2022
@GitMensch
Copy link
Contributor Author

This issue was falsely referenced in the commit e62e34c, you may amend this commit to fix the reference.
In any case: should we start with "sub-issues" for actual implementations?

Concerning this issue I'm currently most interested in using the syslog logger as an alternative to the file based one.

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

No branches or pull requests

2 participants