Bug #87596 --log-level=1[none] has no effect on supressing the "info" output
Submitted: 30 Aug 2017 7:16 Modified: 30 Sep 2020 14:35
Reporter: Shahriyar Rzayev Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Document Store: MySQL Shell Severity:S4 (Feature request)
Version:8.0.0 OS:CentOS (7)
Assigned to: CPU Architecture:Any

[30 Aug 2017 7:16] Shahriyar Rzayev
Description:
Hi,
I want to get rid off this INFOs about openning the connection etc.
But it has no effect:

--log-level=value        The log level.
                           Value must be an integer between 1 and 8 any of
                           [none, internal, error, warning, info, debug,
                           debug2, debug3].

$ mysqlsh root:@localhost/generated_columns_test --py --json --interactive --execute "db.get_collections()" --log-level=1
{
    "info": "Creating a Session to 'root@localhost/generated_columns_test'"
}
{
    "info": "Your MySQL connection id is 88 (X protocol) Server version: 5.7.19-17-debug MySQL Community Server (GPL) Default schema `generated_columns_test` accessible through db."
}
[
    {
        "class": "Collection",
        "name": "test_coll"
    },
    {
        "class": "Collection",
        "name": "test_coll1"
    },

$ mysqlsh root:@localhost/generated_columns_test --py --interactive --execute "db.get_collections()" --log-level=1Creating a Session to 'root@localhost/generated_columns_test'
Your MySQL connection id is 89 (X protocol)
Server version: 5.7.19-17-debug MySQL Community Server (GPL)
Default schema `generated_columns_test` accessible through db.
[
    <Collection:test_coll>,
    <Collection:test_coll1>,
    <Collection:test_coll10>,
    <Collection:test_coll11>,

How to repeat:
See description
[30 Aug 2017 8:10] MySQL Verification Team
Hello Shahriyar,

Thank you for the report and reasonable feature request.

Thanks,
Umesh
[27 Sep 2017 19:45] Alfredo Kojima
Posted by developer:
 
--log-level controls the log file created in ~/.mysqlsh/mysqlsh.log

The "info" entries printed to stdout during shell operation in JSON output mode are not log messages.
[28 Sep 2017 7:32] Shahriyar Rzayev
Hello Alfredo,

Thank you for reply.
I got your point.

I think it is quite reasonable to convert it to "Feature Request" and have separate option maybe to suppress "INFO"s to stdout.

It is not only in JSON output but in an ordinary output as well:

$ mysqlsh root:@localhost/generated_columns_test --py --interactive --execute "db.get_collections()" --log-level=1

Creating a Session to 'root@localhost/generated_columns_test'
Your MySQL connection id is 89 (X protocol)
Server version: 5.7.19-17-debug MySQL Community Server (GPL)
Default schema `generated_columns_test` accessible through db.
[
    <Collection:test_coll>,
    <Collection:test_coll1>,
    <Collection:test_coll10>,
    <Collection:test_coll11>
]

The desired output can be such as:

$ mysqlsh root:@localhost/generated_columns_test --py --interactive --execute "db.get_collections()" --only-result/--no-info/ (or some option here)
[<Collection:test_coll>,
 <Collection:test_coll1>,
 <Collection:test_coll10>,
 <Collection:test_coll11>]