• English日本語한국어
  • 로그인지금 시작하기

이 한글 문서는 사용자의 편의를 위해 기계 번역되었습니다.

영문본과 번역본이 일치하지 않는 경우 영문본이 우선합니다. 보다 자세한 내용은 이 페이지를 방문하시기 바랍니다.

문제 신고

record_log_event(Python 에이전트 API)

통사론

newrelic.agent.record_log_event(message, level=None, timestamp=None, attributes=None, application=None, priority=None)

로그인 컨텍스트에서 사용할 로그 이벤트를 기록합니다.

요구 사항

Python 에이전트 버전 8.5.0 이상.

설명

New Relic UI에서 보고 쿼리할 수 있는 로그 이벤트를 기록합니다. 모니터링되는 트랜잭션의 컨텍스트 외부에서 이를 사용하려면 application 매개변수를 사용하세요.

매개변수

매개변수

설명

message

필수의. message 는 로그 메시지를 정의하며 문자열이어야 합니다.

level

선택 과목. 로깅 수준을 정의합니다. 기본값은 UNKNOWN 입니다.

timestamp

뜨다

선택 과목. 로그 메시지의 타임스탬프를 정의합니다. 기본값은 time.time() 입니다.

application

물체

선택 과목. 모니터링되는 트랜잭션의 컨텍스트 외부에서 로그 이벤트를 기록하려는 경우 이를 사용하여 호출을 특정 애플리케이션 개체와 연결합니다. 애플리케이션 객체는 newrelic.agent.application 함수를 사용하여 얻을 수 있습니다.

priority

물체

선택 과목. 로그 이벤트의 우선 순위를 설정합니다. 우선순위가 로깅 이벤트에 미치는 영향에 대한 추가 정보는 event_harvest_config.harvest_limits.log_event_data 참조하세요.

반환 값

없음.

백그라운드 작업에 로그 이벤트 기록

다음은 백그라운드 작업과 관련된 로그 이벤트를 기록하는 예입니다.

@newrelic.agent.background_task()
def bg_task():
# do some type of work in this background task...
application = newrelic.agent.application()
newrelic.agent.record_log_event('My log message.', application)

트랜잭션에 로그 이벤트 기록

트랜잭션 내에서 로그 이벤트를 기록하는 예:

def fetch():
newrelic.agent.record_log_event('Fetching data.')
# do some type of work in this transaction...
Copyright © 2023 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.