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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
98448401
Commit
98448401
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
55b78e44
ba3086a2
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 @
98448401
...
...
@@ -125,6 +125,18 @@ public:
*/
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
*
...
...
@@ -195,6 +207,7 @@ private:
const
char
*
m_pDateTimeFormat
;
int
m_errorCode
;
char
*
m_errorStr
;
// for handling repeated messages
unsigned
m_count_repeated_messages
;
...
...
ndb/include/logger/Logger.hpp
View file @
98448401
...
...
@@ -178,8 +178,11 @@ public:
* Add a new handler
*
* @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.
...
...
ndb/src/common/logger/FileLogHandler.cpp
View file @
98448401
...
...
@@ -187,6 +187,7 @@ FileLogHandler::setParam(const BaseString ¶m, const BaseString &value){
return
setMaxSize
(
value
);
if
(
param
==
"maxfiles"
)
return
setMaxFiles
(
value
);
setErrorStr
(
"Invalid parameter"
);
return
false
;
}
...
...
@@ -196,16 +197,18 @@ FileLogHandler::setFilename(const BaseString &filename) {
if
(
m_pLogFile
)
delete
m_pLogFile
;
m_pLogFile
=
new
File_class
(
filename
.
c_str
(),
"a+"
);
open
();
return
true
;
return
open
();
}
bool
FileLogHandler
::
setMaxSize
(
const
BaseString
&
size
)
{
char
*
end
;
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
;
}
if
(
end
[
0
]
==
'M'
)
val
*=
1024
*
1024
;
if
(
end
[
0
]
==
'k'
)
...
...
@@ -220,8 +223,11 @@ bool
FileLogHandler
::
setMaxFiles
(
const
BaseString
&
files
)
{
char
*
end
;
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
;
}
m_maxNoFiles
=
val
;
return
true
;
...
...
@@ -230,6 +236,9 @@ FileLogHandler::setMaxFiles(const BaseString &files) {
bool
FileLogHandler
::
checkParams
()
{
if
(
m_pLogFile
==
NULL
)
{
setErrorStr
(
"Log file cannot be null."
);
return
false
;
}
return
true
;
}
ndb/src/common/logger/LogHandler.cpp
View file @
98448401
...
...
@@ -23,7 +23,8 @@
//
LogHandler
::
LogHandler
()
:
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_count_repeated_messages
=
0
;
...
...
@@ -155,6 +156,19 @@ LogHandler::setErrorCode(int code)
m_errorCode
=
code
;
}
char
*
LogHandler
::
getErrorStr
()
{
return
m_errorStr
;
}
void
LogHandler
::
setErrorStr
(
char
*
str
)
{
m_errorStr
=
str
;
}
bool
LogHandler
::
parseParams
(
const
BaseString
&
_params
)
{
Vector
<
BaseString
>
v_args
;
...
...
@@ -165,9 +179,18 @@ LogHandler::parseParams(const BaseString &_params) {
for
(
size_t
i
=
0
;
i
<
v_args
.
size
();
i
++
)
{
Vector
<
BaseString
>
v_param_value
;
if
(
v_args
[
i
].
split
(
v_param_value
,
"="
,
2
)
!=
2
)
{
ret
=
false
;
else
if
(
!
setParam
(
v_param_value
[
0
],
v_param_value
[
1
]))
ret
=
false
;
setErrorStr
(
"Can't find key=value pair."
);
}
else
{
v_param_value
[
0
].
trim
(
"
\t
"
);
if
(
!
setParam
(
v_param_value
[
0
],
v_param_value
[
1
]))
{
ret
=
false
;
}
}
}
if
(
!
checkParams
())
...
...
ndb/src/common/logger/Logger.cpp
View file @
98448401
...
...
@@ -167,7 +167,7 @@ Logger::addHandler(LogHandler* pHandler)
}
bool
Logger
::
addHandler
(
const
BaseString
&
logstring
)
{
Logger
::
addHandler
(
const
BaseString
&
logstring
,
int
*
err
,
int
len
,
char
*
errStr
)
{
size_t
i
;
Vector
<
BaseString
>
logdest
;
Vector
<
LogHandler
*>
loghandlers
;
...
...
@@ -200,9 +200,18 @@ Logger::addHandler(const BaseString &logstring) {
handler
=
new
ConsoleLogHandler
();
if
(
handler
==
NULL
)
{
snprintf
(
errStr
,
len
,
"Could not create log destination: %s"
,
logdest
[
i
].
c_str
());
DBUG_RETURN
(
false
);
}
if
(
!
handler
->
parseParams
(
params
))
{
*
err
=
handler
->
getErrorCode
();
if
(
handler
->
getErrorStr
())
strncpy
(
errStr
,
handler
->
getErrorStr
(),
len
);
DBUG_RETURN
(
false
);
}
loghandlers
.
push_back
(
handler
);
}
...
...
ndb/src/common/logger/SysLogHandler.cpp
View file @
98448401
...
...
@@ -154,5 +154,6 @@ SysLogHandler::setFacility(const BaseString &facility) {
return
true
;
}
}
setErrorStr
(
"Invalid syslog facility name"
);
return
false
;
}
ndb/src/mgmsrv/MgmtSrvr.cpp
View file @
98448401
...
...
@@ -179,6 +179,8 @@ MgmtSrvr::startEventLog()
}
const
char
*
tmp
;
char
errStr
[
100
];
int
err
=
0
;
BaseString
logdest
;
char
*
clusterLog
=
NdbConfig_ClusterLogFileName
(
_ownNodeId
);
NdbAutoPtr
<
char
>
tmp_aptr
(
clusterLog
);
...
...
@@ -192,9 +194,17 @@ MgmtSrvr::startEventLog()
logdest
.
assfmt
(
"FILE:filename=%s,maxsize=1000000,maxfiles=6"
,
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
\"
"
<<
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