Opened 6 years ago

Closed 6 years ago

#1661 closed defect (fixed)

improve log readability: less newlines

Reported by: Peter Baumann Owned by:
Priority: minor Milestone: Future
Component: undecided Version: development
Keywords: Cc: Dimitar Misev, Bang Pham Huu, Vlad Merticariu
Complexity: Easy

Description

Our logs are overly verbose. With this ticket, a particular rule should be reminded of:

one log item = one line, ex:
Creating RASBASE...ok. 

Concerns install (and other) script, log output.

Change History (9)

comment:1 by Dimitar Misev, 6 years ago

This looks somewhat better perhaps:

create_db.sh: Creating database, rasdaman v9.5 on base DBMS sqlite
create_db.sh: rasdaman dictionary initialization... 
create_db.sh: Filestorage directory '/d/rasdata' not found, creating... ok.
rasdl: rasdaman schema and database manipulation tool, rasdaman 9.5.0 on base DBMS sqlite.
Creating base RASBASE...ok
rasdl: done.
rasdl: rasdaman schema and database manipulation tool, rasdaman 9.5.0 on base DBMS sqlite.
Reading rasdaman data definition file /home/dimitar/rasdaman/community/src-install/share/rasdaman/examples/rasdl/basictypes.dl...inserting symbols into database...ok
rasdl: done.
create_db.sh: done.

but I think it would be even better to hide rasdl's own output:

create_db.sh: creating database, rasdaman v9.5 on base DBMS sqlite 
create_db.sh: filestorage directory '/d/rasdata' not found, creating... ok.
create_db.sh: creating RASBASE... ok.
create_db.sh: inserting standard types into RASBASE... ok
create_db.sh: done.

comment:2 by Peter Baumann, 6 years ago

as a rule of thumb, subordinate tools should only speak up in case of errors, so we might call them with -q. If the top-level tool does not have a newline then any error msg will nicely be aligned with the action the script has initiated.

No problem to have several "…" in a line, BTW.

If the script has a longer action then it should mark that appropriately, not using "…". Ex:

create_db.sh: rasdaman dictionary initialization: start.
create_db.sh: Filestorage directory '/d/rasdata' not found, creating... ok.
create_db.sh: Creating base RASBASE...ok
create_db.sh: rasdaman dictionary initialization: done.

I liked to have shell variables $DONE, $ERROR to ensure it's always the same terminology, thereby allowing grep.

comment:3 by Dimitar Misev, 6 years ago

here's how it looks now:

create_db.sh:

create_db.sh: creating database, rasdaman v9.5 on base DBMS sqlite
create_db.sh: filestorage directory '/d/rasdata' not found, creating... ok.
create_db.sh: rasdaman dictionary initialization... 
create_db.sh:   creating RASBASE... ok.
create_db.sh:   inserting standard types... ok.
create_db.sh: done.

start_rasdaman.sh:

start_rasdaman.sh: starting rasdaman server complex...
start_rasdaman.sh:   starting rasmgr... ok, pid 26766.
start_rasdaman.sh:   starting all rasdaman servers... ok.
start_rasdaman.sh: running check query... ok.
start_rasdaman.sh: done.

stop_rasdaman.sh:

stop_rasdaman.sh: terminating all rasdaman servers
stop_rasdaman.sh: terminating server N1...done.
stop_rasdaman.sh: terminating server N2...done.
stop_rasdaman.sh: terminating server N4...done.
stop_rasdaman.sh: terminating server N5...done.
stop_rasdaman.sh: terminating server N6...done.
stop_rasdaman.sh: terminating server N7...done.
stop_rasdaman.sh: terminating server N8...done.
stop_rasdaman.sh: terminating server N9...done.
stop_rasdaman.sh: terminating rasmanager. Good Bye!
stop_rasdaman.sh: done.

comment:4 by Peter Baumann, 6 years ago

another example, rasserver log:

 [INFO] - 19/12/2017 10:35:38.236887: Server 42f27219-c7a0-4caa-843c-aa7197468afa of type 
 [INFO] - 19/12/2017 10:35:38.236891: RPC, registered with prognum 0x1b5a
 [INFO] - 19/12/2017 10:35:38.236893: , connecting to sqlite as '/opt/rasdaman/data//RASBASE'
 [INFO] - 19/12/2017 10:35:38.236895: Verifying rasmgr host name: localhost...
 [INFO] - 19/12/2017 10:35:38.236977: ok

comment:5 by Dimitar Misev, 6 years ago

Unfortunately this is hard to fix because the log macros of easylogging automatically output a new line.

in reply to:  3 comment:6 by Peter Baumann, 6 years ago

wonderful, much nicer! :)

I wonder about this, BTW:

    echo -n "$PROG: Filestorage directory '$datadir' not found, creating... "
    mkdir -p "$datadir" || error "failed creating filestorage directory '$datadir'."
    echo "ok."

…this will always give an ok. Maybe you can fix it quickly?

comment:7 by Dimitar Misev, 6 years ago

no actually

mkdir -p "$datadir" || error "failed creating filestorage directory '$datadir'."

if mkdir -p fails it calls the error function which exits the script. Here's an example:

create_db.sh: creating database, rasdaman v9.5 on base DBMS sqlite
create_db.sh: filestorage directory '/root/data' not found, creating... mkdir: cannot create directory ‘/root’: Permission denied

create_db.sh: failed creating filestorage directory '/root/data'.

in reply to:  7 comment:8 by Peter Baumann, 6 years ago

oops, my bad - should have looked up the definition.

in reply to:  4 comment:9 by Dimitar Misev, 6 years ago

Resolution: fixed
Status: newclosed

Replying to pbaumann:

another example, rasserver log:

 [INFO] - 19/12/2017 10:35:38.236887: Server 42f27219-c7a0-4caa-843c-aa7197468afa of type 
 [INFO] - 19/12/2017 10:35:38.236891: RPC, registered with prognum 0x1b5a
 [INFO] - 19/12/2017 10:35:38.236893: , connecting to sqlite as '/opt/rasdaman/data//RASBASE'
 [INFO] - 19/12/2017 10:35:38.236895: Verifying rasmgr host name: localhost...
 [INFO] - 19/12/2017 10:35:38.236977: ok

Fixed now, here's how the rasserver log typically looks like:

 [INFO] - 2018-04-03 11:39:11,412: rasserver: rasdaman server 9.6.0 on base DBMS sqlite.
 [INFO] - 2018-04-03 11:39:11,412:  Copyright 2003 - 2018 Peter Baumann / rasdaman GmbH. 
 Rasdaman community is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. 
 Rasdaman community is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 [INFO] - 2018-04-03 11:39:11,412: To obtain a list of external packages used, please visit www.rasdaman.org.

 [INFO] - 2018-04-03 11:39:11,412: Server 53cacc1c-7c5f-4340-be9c-8a43174f3c4f of type rasnet, listening on port 9000, connecting to sqlite as '/d/rasdata/RASBASE'
 [INFO] - 2018-04-03 11:39:11,412: Verifying rasmgr host name: localhost... ok
 [INFO] - 2018-04-03 11:39:11,412: Tile size set to : 4194304
 [INFO] - 2018-04-03 11:39:11,413: PCTMin set to    : 2048
 [INFO] - 2018-04-03 11:39:11,413: PCTMax set to    : 4096
 [INFO] - 2018-04-03 11:39:11,413: IndexSize set to : 0
 [INFO] - 2018-04-03 11:39:11,413: Default Tile Conf: [0:1023,0:1023]
 [INFO] - 2018-04-03 11:39:11,413: Default Tiling   : AlignedTiling
 [INFO] - 2018-04-03 11:39:11,413: Default Index    : r_RPlus_Tree_Index
 [INFO] - 2018-04-03 11:39:11,413: Tile Container   : 0
 [INFO] - 2018-04-03 11:39:11,413: Cache size limit : 0
 [INFO] - 2018-04-03 11:39:11,413: Installing signal handler for ignoring broken pipe signal... ok.

 [INFO] - 2018-04-03 11:39:18,159: Request: 'select c from RAS_COLLECTIONNAMES AS c'... parsing... checking semantics... evaluating... ok, result type 'set <marray <char, [0:23]>>', 158 element(s), total size 3792 bytes.

Sample rasql output:

$ rasql -q 'select version()' --out string
rasql: rasdaman query tool v1.0, rasdaman 9.6.0.
Opening database RASBASE at localhost:7001... ok.
Executing retrieval query... ok.
Query result collection has 1 element(s):
  Result object 1: rasdaman 9.6.0 on x86_64-linux-gnu, compiled by g++ (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904
rasql done.

Error rasql output, where the error message will be in red font "rasdaman error 355: Execution error 355 in line 1, column 21, near token invalid: Collection name is unknown.":

$ rasql -q 'select invalid from invalid' --out string
rasql: rasdaman query tool v1.0, rasdaman 9.6.0.
Opening database RASBASE at localhost:7001... ok.
Executing retrieval query... rasdaman error 355: Execution error 355 in line 1, column 21, near token invalid: Collection name is unknown.
aborting transaction... ok.
rasql done.
Note: See TracTickets for help on using tickets.