Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
dd0bde0d
Commit
dd0bde0d
authored
Jan 18, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/stewart/Documents/MySQL/4.1/main
into mysql.com:/home/stewart/Documents/MySQL/4.1/bug11331
parents
b7aa4e8d
5291e47c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
11 deletions
+79
-11
ndb/include/logger/LogHandler.hpp
ndb/include/logger/LogHandler.hpp
+13
-0
ndb/include/logger/Logger.hpp
ndb/include/logger/Logger.hpp
+4
-1
ndb/src/common/logger/FileLogHandler.cpp
ndb/src/common/logger/FileLogHandler.cpp
+13
-4
ndb/src/common/logger/LogHandler.cpp
ndb/src/common/logger/LogHandler.cpp
+26
-3
ndb/src/common/logger/Logger.cpp
ndb/src/common/logger/Logger.cpp
+10
-1
ndb/src/common/logger/SysLogHandler.cpp
ndb/src/common/logger/SysLogHandler.cpp
+1
-0
ndb/src/mgmsrv/MgmtSrvr.cpp
ndb/src/mgmsrv/MgmtSrvr.cpp
+12
-2
No files found.
ndb/include/logger/LogHandler.hpp
View file @
dd0bde0d
...
@@ -125,6 +125,18 @@ public:
...
@@ -125,6 +125,18 @@ public:
*/
*/
void
setErrorCode
(
int
code
);
void
setErrorCode
(
int
code
);
/**
* Returns the error string.
*/
char
*
getErrorStr
();
/**
* Sets the error string.
*
* @param str the error string.
*/
void
setErrorStr
(
char
*
str
);
/**
/**
* Parse logstring parameters
* Parse logstring parameters
*
*
...
@@ -195,6 +207,7 @@ private:
...
@@ -195,6 +207,7 @@ private:
const
char
*
m_pDateTimeFormat
;
const
char
*
m_pDateTimeFormat
;
int
m_errorCode
;
int
m_errorCode
;
char
*
m_errorStr
;
// for handling repeated messages
// for handling repeated messages
unsigned
m_count_repeated_messages
;
unsigned
m_count_repeated_messages
;
...
...
ndb/include/logger/Logger.hpp
View file @
dd0bde0d
...
@@ -178,8 +178,11 @@ public:
...
@@ -178,8 +178,11 @@ public:
* Add a new handler
* Add a new handler
*
*
* @param logstring string describing the handler to add
* @param logstring string describing the handler to add
* @param err OS errno in event of error
* @param len max length of errStr buffer
* @param errStr logger error string in event of error
*/
*/
bool
addHandler
(
const
BaseString
&
logstring
);
bool
addHandler
(
const
BaseString
&
logstring
,
int
*
err
,
int
len
,
char
*
errStr
);
/**
/**
* Remove a log handler.
* Remove a log handler.
...
...
ndb/src/common/logger/FileLogHandler.cpp
View file @
dd0bde0d
...
@@ -187,6 +187,7 @@ FileLogHandler::setParam(const BaseString ¶m, const BaseString &value){
...
@@ -187,6 +187,7 @@ FileLogHandler::setParam(const BaseString ¶m, const BaseString &value){
return
setMaxSize
(
value
);
return
setMaxSize
(
value
);
if
(
param
==
"maxfiles"
)
if
(
param
==
"maxfiles"
)
return
setMaxFiles
(
value
);
return
setMaxFiles
(
value
);
setErrorStr
(
"Invalid parameter"
);
return
false
;
return
false
;
}
}
...
@@ -196,16 +197,18 @@ FileLogHandler::setFilename(const BaseString &filename) {
...
@@ -196,16 +197,18 @@ FileLogHandler::setFilename(const BaseString &filename) {
if
(
m_pLogFile
)
if
(
m_pLogFile
)
delete
m_pLogFile
;
delete
m_pLogFile
;
m_pLogFile
=
new
File_class
(
filename
.
c_str
(),
"a+"
);
m_pLogFile
=
new
File_class
(
filename
.
c_str
(),
"a+"
);
open
();
return
open
();
return
true
;
}
}
bool
bool
FileLogHandler
::
setMaxSize
(
const
BaseString
&
size
)
{
FileLogHandler
::
setMaxSize
(
const
BaseString
&
size
)
{
char
*
end
;
char
*
end
;
long
val
=
strtol
(
size
.
c_str
(),
&
end
,
0
);
/* XXX */
long
val
=
strtol
(
size
.
c_str
(),
&
end
,
0
);
/* XXX */
if
(
size
.
c_str
()
==
end
)
if
(
size
.
c_str
()
==
end
||
val
<
0
)
{
setErrorStr
(
"Invalid file size"
);
return
false
;
return
false
;
}
if
(
end
[
0
]
==
'M'
)
if
(
end
[
0
]
==
'M'
)
val
*=
1024
*
1024
;
val
*=
1024
*
1024
;
if
(
end
[
0
]
==
'k'
)
if
(
end
[
0
]
==
'k'
)
...
@@ -220,8 +223,11 @@ bool
...
@@ -220,8 +223,11 @@ bool
FileLogHandler
::
setMaxFiles
(
const
BaseString
&
files
)
{
FileLogHandler
::
setMaxFiles
(
const
BaseString
&
files
)
{
char
*
end
;
char
*
end
;
long
val
=
strtol
(
files
.
c_str
(),
&
end
,
0
);
long
val
=
strtol
(
files
.
c_str
(),
&
end
,
0
);
if
(
files
.
c_str
()
==
end
)
if
(
files
.
c_str
()
==
end
||
val
<
1
)
{
setErrorStr
(
"Invalid maximum number of files"
);
return
false
;
return
false
;
}
m_maxNoFiles
=
val
;
m_maxNoFiles
=
val
;
return
true
;
return
true
;
...
@@ -230,6 +236,9 @@ FileLogHandler::setMaxFiles(const BaseString &files) {
...
@@ -230,6 +236,9 @@ FileLogHandler::setMaxFiles(const BaseString &files) {
bool
bool
FileLogHandler
::
checkParams
()
{
FileLogHandler
::
checkParams
()
{
if
(
m_pLogFile
==
NULL
)
if
(
m_pLogFile
==
NULL
)
{
setErrorStr
(
"Log file cannot be null."
);
return
false
;
return
false
;
}
return
true
;
return
true
;
}
}
ndb/src/common/logger/LogHandler.cpp
View file @
dd0bde0d
...
@@ -23,7 +23,8 @@
...
@@ -23,7 +23,8 @@
//
//
LogHandler
::
LogHandler
()
:
LogHandler
::
LogHandler
()
:
m_pDateTimeFormat
(
"%d-%.2d-%.2d %.2d:%.2d:%.2d"
),
m_pDateTimeFormat
(
"%d-%.2d-%.2d %.2d:%.2d:%.2d"
),
m_errorCode
(
0
)
m_errorCode
(
0
),
m_errorStr
(
NULL
)
{
{
m_max_repeat_frequency
=
3
;
// repeat messages maximum every 3 seconds
m_max_repeat_frequency
=
3
;
// repeat messages maximum every 3 seconds
m_count_repeated_messages
=
0
;
m_count_repeated_messages
=
0
;
...
@@ -155,6 +156,19 @@ LogHandler::setErrorCode(int code)
...
@@ -155,6 +156,19 @@ LogHandler::setErrorCode(int code)
m_errorCode
=
code
;
m_errorCode
=
code
;
}
}
char
*
LogHandler
::
getErrorStr
()
{
return
m_errorStr
;
}
void
LogHandler
::
setErrorStr
(
char
*
str
)
{
m_errorStr
=
str
;
}
bool
bool
LogHandler
::
parseParams
(
const
BaseString
&
_params
)
{
LogHandler
::
parseParams
(
const
BaseString
&
_params
)
{
Vector
<
BaseString
>
v_args
;
Vector
<
BaseString
>
v_args
;
...
@@ -165,9 +179,18 @@ LogHandler::parseParams(const BaseString &_params) {
...
@@ -165,9 +179,18 @@ LogHandler::parseParams(const BaseString &_params) {
for
(
size_t
i
=
0
;
i
<
v_args
.
size
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
v_args
.
size
();
i
++
)
{
Vector
<
BaseString
>
v_param_value
;
Vector
<
BaseString
>
v_param_value
;
if
(
v_args
[
i
].
split
(
v_param_value
,
"="
,
2
)
!=
2
)
if
(
v_args
[
i
].
split
(
v_param_value
,
"="
,
2
)
!=
2
)
{
ret
=
false
;
ret
=
false
;
else
if
(
!
setParam
(
v_param_value
[
0
],
v_param_value
[
1
]))
setErrorStr
(
"Can't find key=value pair."
);
ret
=
false
;
}
else
{
v_param_value
[
0
].
trim
(
"
\t
"
);
if
(
!
setParam
(
v_param_value
[
0
],
v_param_value
[
1
]))
{
ret
=
false
;
}
}
}
}
if
(
!
checkParams
())
if
(
!
checkParams
())
...
...
ndb/src/common/logger/Logger.cpp
View file @
dd0bde0d
...
@@ -167,7 +167,7 @@ Logger::addHandler(LogHandler* pHandler)
...
@@ -167,7 +167,7 @@ Logger::addHandler(LogHandler* pHandler)
}
}
bool
bool
Logger
::
addHandler
(
const
BaseString
&
logstring
)
{
Logger
::
addHandler
(
const
BaseString
&
logstring
,
int
*
err
,
int
len
,
char
*
errStr
)
{
size_t
i
;
size_t
i
;
Vector
<
BaseString
>
logdest
;
Vector
<
BaseString
>
logdest
;
Vector
<
LogHandler
*>
loghandlers
;
Vector
<
LogHandler
*>
loghandlers
;
...
@@ -200,9 +200,18 @@ Logger::addHandler(const BaseString &logstring) {
...
@@ -200,9 +200,18 @@ Logger::addHandler(const BaseString &logstring) {
handler
=
new
ConsoleLogHandler
();
handler
=
new
ConsoleLogHandler
();
if
(
handler
==
NULL
)
if
(
handler
==
NULL
)
{
snprintf
(
errStr
,
len
,
"Could not create log destination: %s"
,
logdest
[
i
].
c_str
());
DBUG_RETURN
(
false
);
DBUG_RETURN
(
false
);
}
if
(
!
handler
->
parseParams
(
params
))
if
(
!
handler
->
parseParams
(
params
))
{
*
err
=
handler
->
getErrorCode
();
if
(
handler
->
getErrorStr
())
strncpy
(
errStr
,
handler
->
getErrorStr
(),
len
);
DBUG_RETURN
(
false
);
DBUG_RETURN
(
false
);
}
loghandlers
.
push_back
(
handler
);
loghandlers
.
push_back
(
handler
);
}
}
...
...
ndb/src/common/logger/SysLogHandler.cpp
View file @
dd0bde0d
...
@@ -154,5 +154,6 @@ SysLogHandler::setFacility(const BaseString &facility) {
...
@@ -154,5 +154,6 @@ SysLogHandler::setFacility(const BaseString &facility) {
return
true
;
return
true
;
}
}
}
}
setErrorStr
(
"Invalid syslog facility name"
);
return
false
;
return
false
;
}
}
ndb/src/mgmsrv/MgmtSrvr.cpp
View file @
dd0bde0d
...
@@ -179,6 +179,8 @@ MgmtSrvr::startEventLog()
...
@@ -179,6 +179,8 @@ MgmtSrvr::startEventLog()
}
}
const
char
*
tmp
;
const
char
*
tmp
;
char
errStr
[
100
];
int
err
=
0
;
BaseString
logdest
;
BaseString
logdest
;
char
*
clusterLog
=
NdbConfig_ClusterLogFileName
(
_ownNodeId
);
char
*
clusterLog
=
NdbConfig_ClusterLogFileName
(
_ownNodeId
);
NdbAutoPtr
<
char
>
tmp_aptr
(
clusterLog
);
NdbAutoPtr
<
char
>
tmp_aptr
(
clusterLog
);
...
@@ -192,9 +194,17 @@ MgmtSrvr::startEventLog()
...
@@ -192,9 +194,17 @@ MgmtSrvr::startEventLog()
logdest
.
assfmt
(
"FILE:filename=%s,maxsize=1000000,maxfiles=6"
,
logdest
.
assfmt
(
"FILE:filename=%s,maxsize=1000000,maxfiles=6"
,
clusterLog
);
clusterLog
);
}
}
if
(
!
g_eventLogger
.
addHandler
(
logdest
))
{
errStr
[
0
]
=
'\0'
;
if
(
!
g_eventLogger
.
addHandler
(
logdest
,
&
err
,
sizeof
(
errStr
),
errStr
))
{
ndbout
<<
"Warning: could not add log destination
\"
"
ndbout
<<
"Warning: could not add log destination
\"
"
<<
logdest
.
c_str
()
<<
"
\"
"
<<
endl
;
<<
logdest
.
c_str
()
<<
"
\"
. Reason: "
;
if
(
err
)
ndbout
<<
strerror
(
err
);
if
(
err
&&
errStr
[
0
]
!=
'\0'
)
ndbout
<<
", "
;
if
(
errStr
[
0
]
!=
'\0'
)
ndbout
<<
errStr
;
ndbout
<<
endl
;
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment