Skip to the first comment for a solution.
Hi there,
I'm currently trying to configure a MessageLogging-Policy with Syslog. Without defining the logLevel and without the use of variables for host, port, protocol, ... it works fine.
There seems to be a bug with the logLevel though. Everytime I want to define it, regardless what logLevel-value I choose, I get deployment errors, stating logLevel is not a part of the policy's schema:
"Error Saving Revision X
Error
occurred while validation of bean log-error.xml. Reason: -
Schema validation failed. Cause : unexpected element (uri:"",
local:"logLevel"). Expected elements are
<{}FormatMessage>,<{}SSLInfo>,<{}Message>,<{}Port>,<{}Host>,<{}Protocol>.
Line number : 13. Column number : 19. File name :
log-error.xml."
Furthermore, I want to use different syslog-servers for different environments. So I created a KeyValueMap holding the syslog-configuration parameters (Host, port, etc.). Extracting the values and assigning them to variables works fine. When I want to use them in the MessageLogging-Policy, however, I get the following deployment error:
"
Error Saving Revision X
Error
occurred while validation of bean log-error.xml. Reason: -
Schema validation failed. Cause : Not a number: {syslog.port}. Line
number : 7. Column number : 35. File name : log-error.xml."
(Validation also fails for all other variables except host)
Here's my MessageLogging configuration:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <MessageLogging async="false" continueOnError="false" enabled="true" name="log-error"> <DisplayName>log-error</DisplayName> <Syslog> <logLevel>ERROR</logLevel> <Message>[XYZ tag="{organization.name}" tag="{apiproxy.name}" tag="{environment.name}"] APIGEE Error ...</Message> <Host>{syslog.host}</Host> <Port>{syslog.port}</Port> <Protocol>{syslog.protocol}</Protocol> <SSLInfo> <Enabled>{syslog.use-ssl}</Enabled> </SSLInfo> <FormatMessage>{syslog.format-message}</FormatMessage> </Syslog> </MessageLogging>
Would be great if someone could help me with these issues.
Thank you and regards, Jan
Solved! Go to Solution.
Hi.
Regarding
"Error Saving Revision X
Error occurred while validation of bean log-error.xml. Reason: - Schema validation failed. Cause : unexpected element (uri:"", local:"logLevel"). Expected elements are <{}FormatMessage>,<{}SSLInfo>,<{}Message>,<{}Port>,<{}Host>,<{}Protocol>. Line number : 13. Column number : 19. File name : log-error.xml."
The logLevel element is a child of MessageLogging, not a child of Syslog. Therefore you must use something like this:
<MessageLogging name="log-error"> <logLevel>ERROR</logLevel> <Syslog> <Message>...</Message> ... </Syslog> </MessageLogging>
It is not possible to have the logLevel be determined by a variable.
Regarding the setting of host and port via variables, we have that feature request in the backlog. ref: b/65739579 .