-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3cd6bea
commit 4a59a12
Showing
11 changed files
with
503 additions
and
5 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
guides/micronaut-azure-logging/groovy/src/main/groovy/example/micronaut/LogController.groovy
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,31 @@ | ||
/* | ||
* Copyright 2017-2024 original authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package example.micronaut | ||
|
||
import groovy.util.logging.Slf4j | ||
import io.micronaut.http.annotation.Body | ||
import io.micronaut.http.annotation.Controller | ||
import io.micronaut.http.annotation.Post | ||
|
||
@Slf4j('LOG') | ||
@Controller | ||
class LogController { | ||
|
||
@Post('/log') | ||
void log(@Body String message) { | ||
LOG.info(message) | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
guides/micronaut-azure-logging/java/src/main/java/example/micronaut/LogController.java
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,33 @@ | ||
/* | ||
* Copyright 2017-2024 original authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package example.micronaut; | ||
|
||
import io.micronaut.http.annotation.Body; | ||
import io.micronaut.http.annotation.Controller; | ||
import io.micronaut.http.annotation.Post; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
@Controller | ||
class LogController { | ||
|
||
private static final Logger LOG = LoggerFactory.getLogger(LogController.class); | ||
|
||
@Post("/log") | ||
void log(@Body String message) { | ||
LOG.info(message); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
guides/micronaut-azure-logging/kotlin/src/main/kotlin/example/micronaut/LogController.kt
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,35 @@ | ||
/* | ||
* Copyright 2017-2024 original authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package example.micronaut; | ||
|
||
import io.micronaut.http.annotation.Body | ||
import io.micronaut.http.annotation.Controller | ||
import io.micronaut.http.annotation.Post | ||
import org.slf4j.Logger | ||
import org.slf4j.LoggerFactory | ||
|
||
@Controller | ||
class LogController { | ||
|
||
@Post("/log") | ||
fun log(@Body message: String) { | ||
LOG.info(message) | ||
} | ||
|
||
companion object { | ||
private val LOG: Logger = LoggerFactory.getLogger(LogController::class.java) | ||
} | ||
} |
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,14 @@ | ||
{ | ||
"title": "Publish Micronaut application logs to Microsoft Azure Monitor Logs", | ||
"intro": "Learn how to send your Micronaut application Logback logs to Microsoft Azure Monitor Logs.", | ||
"authors": ["Burt Beckwith"], | ||
"tags": ["azure", "cloud"], | ||
"categories": ["Microsoft Azure"], | ||
"publicationDate": "2024-08-22", | ||
"apps": [ | ||
{ | ||
"name": "default", | ||
"features": [] | ||
} | ||
] | ||
} |
Oops, something went wrong.