Im trying to install LOG4PLSQL . There is a build process on linux server, which put logs into file.
After processing all files there is a command, which checks text file if it contains a ORA- string,
Problem is, that in log4plsql code actually contains one ORA- :
BEGIN
build 20-Jun-2018 09:22:28 1960 checkAndInitCTX(pCTX);
build 20-Jun-2018 09:22:28 1961 LLTEXT := 'SQLCODE:'||SQLCODE ||' SQLERRM:'||SQLERRM || CHR(10) ||
build 20-Jun-2018 09:22:28 1962 'Error back trace:' || CHR(10) ||
build 20-Jun-2018 09:22:28 1963 replace(dbms_utility.format_error_backtrace, 'ORA-06512: ', ''); -- <<<<<<<<<<
build 20-Jun-2018 09:22:28 1964 log(pLEVEL => PLOGPARAM.DEFAULT_FT_ERR_BTRACE_LEVEL, pCTX => pCTX, pTEXT => LLTEXT );
build 20-Jun-2018 09:22:28 1965 END full_error_backtrace;
build 20-Jun-2018 09:22:28 1966
build 20-Jun-2018 09:22:28 1967
build 20-Jun-2018 09:22:28 1968 FUNCTION getLOG4PLSQVersion
build 20-Jun-2018 09:22:28 1969 RETURN VARCHAR2
and although build has no errors, this grep function find one in package code and treat it like an error.
Grep responsible for finding ORA: grep "ORA-"
I modify it to: grep "[^']ORA-"
and ORA- with ' ('ORA-) is now invisible, but invisible is also actual error:
ORA-00955: name is already being used by existing object
so for example, in this log:
BEGIN
checkAndInitCTX(pCTX);
LLTEXT := 'SQLCODE:'||SQLCODE ||' SQLERRM:'||SQLERRM || CHR(10) ||
'Error back trace:' || CHR(10) ||
replace(dbms_utility.format_error_backtrace, 'ORA-06512: ', '');
log(pLEVEL => PLOGPARAM.DEFAULT_FT_ERR_BTRACE_LEVEL, pCTX => pCTX, pTEXT => LLTEXT );
END full_error_backtrace;
ORA-00955: name is already being used by existing object
my grep wont find any ORA.
Anyone has an idea?
The problem is that when you add the [^']
to the regex grep
expects a character on the left-hand side of ORA-
, but - since the pattern is potentially at the beginning of the line in the case of a genuine error - it will potentially fail to find one (as it has done in your example above).
Some regex guru might have a more elegant solution, but the following works for me:
grep -E "(^|[^'])ORA-" output.log
That will match lines which either begin with ORA-
or contain the pattern ORA-
preceded by any character except '
.
My grep
version:
$ grep --version
grep (GNU grep) 2.27
Try use -P for perl-compatible regexps
grep -P "^ORA-|\\'ORA" log
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.