-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #543 from newrelic/dev
Release 10.2.0
- Loading branch information
Showing
11 changed files
with
280 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
10.1.0 | ||
10.2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
tests/integration/logging/monolog2/test_monolog_escape_chars.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?php | ||
/* | ||
* Copyright 2022 New Relic Corporation. All rights reserved. | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
/*DESCRIPTION | ||
Test that Monolog2 instrumentation escapes characters | ||
properly when encoding to JSON | ||
*/ | ||
|
||
/*SKIPIF | ||
<?php | ||
require('skipif.inc'); | ||
*/ | ||
|
||
/*INI | ||
newrelic.loglevel = verbosedebug | ||
newrelic.application_logging.enabled = true | ||
newrelic.application_logging.forwarding.enabled = true | ||
newrelic.application_logging.metrics.enabled = true | ||
newrelic.application_logging.forwarding.max_samples_stored = 10 | ||
newrelic.application_logging.forwarding.log_level = DEBUG | ||
*/ | ||
|
||
/*EXPECT_METRICS | ||
[ | ||
"?? agent run id", | ||
"?? timeframe start", | ||
"?? timeframe stop", | ||
[ | ||
[{"name": "DurationByCaller/Unknown/Unknown/Unknown/Unknown/all"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name": "DurationByCaller/Unknown/Unknown/Unknown/Unknown/allOther"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name": "Logging/lines"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name": "Logging/lines/DEBUG"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name": "OtherTransaction/all"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name": "OtherTransaction/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name": "OtherTransactionTotalTime"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name": "OtherTransactionTotalTime/php__FILE__"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name": "Supportability/Logging/PHP/Monolog/enabled"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name": "Supportability/library/Monolog/detected"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name": "Supportability/Logging/Forwarding/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]], | ||
[{"name": "Supportability/Logging/Metrics/PHP/enabled"}, [1, "??", "??", "??", "??", "??"]] | ||
] | ||
] | ||
*/ | ||
|
||
|
||
/*EXPECT_LOG_EVENTS | ||
[ | ||
{ | ||
"common": { | ||
"attributes": {} | ||
}, | ||
"logs": [ | ||
{ | ||
"message": "This string has some characters which should be escaped: \" \\ \/ \b \f \n \r \t GBP sign \u00a3xxx", | ||
"level": "DEBUG", | ||
"timestamp": "??", | ||
"trace.id": "??", | ||
"span.id": "??", | ||
"entity.guid": "??", | ||
"entity.name": "tests/integration/logging/monolog2__FILE__", | ||
"hostname": "__HOST__" | ||
} | ||
] | ||
} | ||
] | ||
*/ | ||
|
||
require_once(realpath(dirname(__FILE__)) . '/../../../include/config.php'); | ||
require_once(realpath(dirname(__FILE__)) . '/../../../include/monolog.php'); | ||
require_monolog(2); | ||
|
||
use Monolog\Logger; | ||
use Monolog\Handler\StreamHandler; | ||
use Monolog\Formatter\LineFormatter; | ||
|
||
|
||
function test_logging() { | ||
$logger = new Logger('monolog2'); | ||
|
||
$logfmt = "%channel%.%level_name%: %message% %context%\n"; | ||
$formatter = new LineFormatter($logfmt); | ||
|
||
$stdoutHandler = new StreamHandler('php://stdout', Logger::DEBUG); | ||
$stdoutHandler->setFormatter($formatter); | ||
|
||
$logger->pushHandler($stdoutHandler); | ||
|
||
$logger->debug("This string has some characters which should be escaped: \" \\ / \x08 \f \n \r \t GBP sign \xc2\xa3xxx"); | ||
} | ||
|
||
test_logging(); |
Oops, something went wrong.