Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to set logging levels #445

Merged
merged 5 commits into from
Aug 15, 2022
Merged

Add the ability to set logging levels #445

merged 5 commits into from
Aug 15, 2022

Conversation

tpiperatgod
Copy link
Contributor

(If this PR fixes a github issue, please add Fixes #<xyz>.)

Fixes #413

(or if this PR is one task of a github issue, please add Master Issue: #<xyz> to link to the master issue.)

Master Issue: #

Motivation

Explain here the context, and why you're making that change. What is the problem you're trying to solve.

Modifications

For Java and Python functions, I provide two ways for the user to set the logging level.

  • Set the log level directly

    apiVersion: compute.functionmesh.io/v1alpha1
    kind: Function
    metadata:
      name: function-sample
      namespace: default
    spec:
      java:
        log:
          level: "debug"
  • Provide custom logging configuration file

    apiVersion: compute.functionmesh.io/v1alpha1
    kind: Function
    metadata:
      name: function-sample
      namespace: default
    spec:
      java:
        log:
          logConfig:
            name: "java-log-config-cm"
            key: "java-config-xml"
    ---
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: java-log-config-cm
    data:
      java-config-xml: |
        <Configuration>
            <name>pulsar-functions-kubernetes-instance</name>
            <monitorInterval>30</monitorInterval>
            <Properties>
                <Property>
                    <name>pulsar.log.level</name>
                    <value>DEBUG</value>
                </Property>
                <Property>
                    <name>bk.log.level</name>
                    <value>DEBUG</value>
                </Property>
            </Properties>
            <Appenders>
                <Console>
                    <name>Console</name>
                    <target>SYSTEM_OUT</target>
                    <PatternLayout>
                        <Pattern>%d{ISO8601_OFFSET_DATE_TIME_HHMM} [%t] %-5level %logger{36} - %msg%n</Pattern>
                    </PatternLayout>
                </Console>
            </Appenders>
            <Loggers>
                <Logger>
                    <name>org.apache.pulsar.functions.runtime.shaded.org.apache.bookkeeper</name>
                    <level>${sys:bk.log.level}</level>
                    <additivity>false</additivity>
                    <AppenderRef>
                        <ref>Console</ref>
                    </AppenderRef>
                </Logger>
                <Root>
                    <level>${sys:pulsar.log.level}</level>
                    <AppenderRef>
                        <ref>Console</ref>
                        <level>${sys:pulsar.log.level}</level>
                    </AppenderRef>
                </Root>
            </Loggers>
        </Configuration>
    

For Go functions, currently, only direct log level setting is supported.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Documentation

Check the box below.

Need to update docs?

  • doc-required

    (If you need help on updating docs, create a doc issue)

  • no-need-doc

    (Please explain why)

  • doc

    (If this PR contains doc changes)

@tpiperatgod tpiperatgod requested review from nlu90, freeznet and a team as code owners August 11, 2022 06:19
@github-actions github-actions bot added the doc-required This pr needs a document label Aug 11, 2022
nlu90
nlu90 previously approved these changes Aug 11, 2022
Signed-off-by: laminar <tpiperatgod@gmail.com>
Signed-off-by: laminar <tpiperatgod@gmail.com>
Signed-off-by: laminar <tpiperatgod@gmail.com>
Signed-off-by: laminar <tpiperatgod@gmail.com>
Signed-off-by: laminar <tpiperatgod@gmail.com>
@nlu90 nlu90 merged commit b43e5a6 into streamnative:master Aug 15, 2022
@tpiperatgod tpiperatgod deleted the issue-413 branch August 24, 2022 05:08
@Huanli-Meng Huanli-Meng added doc-added and removed doc-required This pr needs a document labels Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

support define log level
4 participants