# Update log levels for a specific module

`PUT /devops/logging/{moduleName}`

Return outcome modify log level for a specific module

Authentication (security requirement alternatives):

```json
[
  {
    "DevOpsBasic": []
  },
  {
    "DevOpsBearer": []
  }
]
```

- DevOpsBasic: http (basic). Eclipse Ditto devops user (devops) + password (foobar)
- DevOpsBearer: http (bearer). A JSON Web Token issued by a supported OAuth 2.0 Identity Provider for the Eclipse Ditto devops user.

Parameters:

- `moduleName` (path, string, required) - The name of module
  Type: string
  
  Example:
  
  ```json
  "gateway"
  ```

Request body: application/json (required)

Fields to update level log for module

Type: LoggingUpdateFields

Schema: [LoggingUpdateFields](https://sourcey-ditto.pages.dev/http-api-doc/models/loggingupdatefields.md)

- `level` (optional)
  Type: string

- `logger` (optional)
  Type: string
  
  class where apply logger level

```json
"{\n  \"level\": \"info\",\n  \"logger\": \"org.apache.pekko.actor.CoordinatedShutdown\"\n}"
```

Responses:

- 201: Return The summary of the outcome of modified pod

Content type: application/json

Type: ModuleUpdatedLogLevel

Module that has been updated

Schema: [ModuleUpdatedLogLevel](https://sourcey-ditto.pages.dev/http-api-doc/models/moduleupdatedloglevel.md)

- `pod` (optional)
  Reference: [UpdatedLogLevel](https://sourcey-ditto.pages.dev/http-api-doc/models/updatedloglevel.md); Type: UpdatedLogLevel
  
  Details of logging configuration

- 401: The request could not be completed due to missing authentication.

Content type: text/plain

Type: TextUnauthorizeError

Schema: [TextUnauthorizeError](https://sourcey-ditto.pages.dev/http-api-doc/models/textunauthorizeerror.md)

Example:

```json
"The supplied authentication is invalid"
```

## Examples

### cURL

```bash
curl -X PUT 'https://ditto.eclipseprojects.io/devops/logging/gateway' \
  -H 'Authorization: Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE' \
  -H 'Content-Type: application/json' \
  --data-raw '"{\n  \"level\": \"info\",\n  \"logger\": \"org.apache.pekko.actor.CoordinatedShutdown\"\n}"'
```

### JavaScript

```javascript
const response = await fetch('https://ditto.eclipseprojects.io/devops/logging/gateway', {
  method: 'PUT',
  headers: {
    'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
    'Content-Type': 'application/json',
  },
  body: '"{\\n  \\"level\\": \\"info\\",\\n  \\"logger\\": \\"org.apache.pekko.actor.CoordinatedShutdown\\"\\n}"',
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.put(
    'https://ditto.eclipseprojects.io/devops/logging/gateway',
    data='"{\\n  \\"level\\": \\"info\\",\\n  \\"logger\\": \\"org.apache.pekko.actor.CoordinatedShutdown\\"\\n}"'.encode('utf-8'),
    headers={
        'Authorization': 'Basic WU9VUl9VU0VSTkFNRTpZT1VSX1BBU1NXT1JE',
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
