We use appsettings to configure Serilog via JSON, a fairly standard enterprise practice.
But I'm having trouble enabling the UsingAttributes. How does one enable .Destructure.UsingAttributes via JSON config?
I started with a pure Serliog approach, but they indicate that Serilog.Extras.Attributed is deprecated in favor of using Destructurama.Attributed. And in looking at the Destructurama.Attributed github example, I don't understand how to convert that into a JSON configuration. Their example:
var log = new LoggerConfiguration().Destructure.UsingAttributes()
The Serilog documentation for the "Destructure" option is straightforward:
"Destructure": [
{
"Name": "With",
"Args": { "policy": "Sample.CustomPolicy, Sample" }
},
],
However, I don't know what I would use for the "Sample.CustomPolicy, Sample" to get Destructurama to be enabled.
"Destructure": [
{
"Name": "With",
"Args": { "UsingAttributes": WHAT_GOES_HERE}
},
],
I feel like I'm missing something obvious.
I just encountered the same problem and after a few experiments I figured how to have it working using Destructurama.Attributed version 2.0.0 :
You must specify the following using in JSON configuration to make Serilog able to see the library :
"Serilog":
{
"Using":
[
"Destructurama.Attributed"
],
....
}
Inside Serilog configuration, you have to specify this to Destructure to enable the attributes :
"Destructure":
[
{
"Name": "UsingAttributes"
},
....
]
Related
I have my API documented and versioned previously using Swashbuckle.AspNetCore, Microsoft.AspNetCore.Mvc.Api.Analyzers, Microsoft.AspNetCore.Mvc.Versioning and Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer.
Everything was fine but all of a sudden today I noticed that JsonPatchDocument Not getting displayed properly in my swagger. I couldn't figure out what's the root cause. But I suspect some Nuget Package Upgrade?
Previously I remember the JsonPatchDocument in my swagger as something similar below:
{
"Operations": [
{
"value": {},
"path": "string",
"op": "string",
"from": "string"
}
]
}
But now it shows something else,
{
"ContractResolver": {}
}
Please assist on what I'm missing
Make sure you are added the AddNewtonsoftJson in program.cs after install the Microsoft.AspNetCore.Mvc.NewtonsofJson
should be like this :
builder.Services.AddControllers().AddNewtonsoftJson();
I've upgraded to Cloud Endpoints 2.0 which no longer supports RPC. Therefore, I generated a new discovery document and used the service generator with the REST discovery doc as input in order to generate the client library for my iOS app.
Using the new REST discovery doc I am getting the following error when trying to generate the library:
~/workspace/google-api-objectivec-client-for-rest/Source/Tools/ServiceGenerator/build/Release/ServiceGenerator discovery/servUsApi-v1-rest.discovery --outputDir GTLAPI --gtlrFrameworkName GoogleAPIClientForREST
ERROR: Failure, exception: Looking at parameter 'creditKickbackKash:creditAmount', found a type/format pair of 'number/(null)', and don't how to map that to Objective-C
I was able to manually fix this by adding (in numerous places) in the discovery doc, the "format": "double" key and value for all double parameters. Notice creditAmount below is missing a format, like all other doubles.
The generated discovery doc looks like this:
"creditKickbackKash": {
"httpMethod": "PUT",
"id": "servUsApi.admin.creditKickbackKash",
"parameterOrder": [
"userId",
"creditAmount"
],
"parameters": {
"userId": {
"format": "int64",
"location": "path",
"required": true,
"type": "string"
},
"creditAmount": {
"location": "path",
"required": true,
"type": "number"
}
},
"path": "creditKickbackKash/{userId}/{creditAmount}",
"response": {
"$ref": "ResultDTO"
},
"scopes": [
"https://www.googleapis.com/auth/userinfo.email"
]
}
Is anyone else having this issue? How can I get the discovery document generation to properly format the document including double number types?
I had the same problem. I rolled back from 1.9.50 to 1.9.48 and the problem is gone.
I'm trying to add a custom analyzer to elasticsearch via grails plugin. I was able to change the used analyzer to a common analyzer using "searchable" on the domain:
static searchable = {
all = [analyzer: 'snowball']
}
but cannot get it to know a costum analyzer. It is unclear how to translate the following json in the REST API to a groovy closue:
PUT /my_index
{
"settings": {
"analysis": {
"filter": {
"my_synonym_filter": {
"type": "synonym",
"synonyms": [
"british,english",
"queen,monarch"
]
}
},
"analyzer": {
"my_synonyms": {
"tokenizer": "standard",
"filter": [
"lowercase",
"my_synonym_filter"
]
}
}
}
}
}
this question seems to have the same problem but the answer doesn't work, and this answer suggests that it might not be possible, but that doesn't seem reasonable because setting a custom analyzer is pretty basic.
Any suggestions?
There are two ways I see which would help you achieve that.
The first way is by going through the low level API using the injected elasticSearchHelper and accessing ES client directly.
elasticSearchHelper.withElasticSearch { client ->
// Do some stuff with the ElasticSearch client
client.admin()
.indices()
.prepareCreate(indexName)
.setSettings(settings) <--- your settings/analyzers go here
.execute()
.actionGet()
}
A second way involves using an undocumented feature of the ElasticSearchAdminService service, namely the createIndex() method, which allows you to pass in the settings and analyzers you need when creating a new index. The latter basically does exactly the same as the first option above, but you get to use the Grails service directly.
I want to create a new MVC application with Visual Studio Community 2015. I've followed this tutorial on how to do this and I've gone as far as creating the application, but after I click 'Create' to create the application, the error message below is displayed.
Is this message referring to the Azure API version for Visual Studio? If so, how should I resolve this? I've looked online and I can't seem to find anything about this error. I'm a newbie at this, so I'm not sure if I've overlooked anything, but I don't seem to according to the tutorial. Any help is greatly appreciated!
UPDATE
The image below shows the SQL API version I've found. It's odd thought, because it does not match the version shown in the error message.
As the error message says the API have to be in correct format yyyy-MM-dd.
API version I was using recently was 2014-04-01 or 2014-04-01-preview. Try any of these when defining SqlServer resouce.
Also have a look at resources.azure.com if you have any SqlServers created and double check the API version from there..
This does not relate to the Azure Sdk version for Visual Studio. It relates to the (in your case) API version used to create SqlServer instance using Azure Resource Manager
Sample SqlServer and database resource node:
"resources": [
{
"name": "[parameters('sqlServerName')]",
"type": "Microsoft.Sql/servers",
"location": "[resourceGroup().location]",
"apiVersion": "2014-04-01-preview",
"dependsOn": [ ],
"tags": {
"displayName": "SqlServer"
},
"properties": {
"administratorLogin": "[parameters('sqlDatabaseUserName')]",
"administratorLoginPassword": "[parameters('sqlDatabasePassword')]",
"version": "12.0"
},
"resources": [
{
"name": "AllowAllWindowsAzureIps",
"type": "firewallrules",
"location": "[resourceGroup().location]",
"apiVersion": "2014-04-01-preview",
"dependsOn": [
"[concat('Microsoft.Sql/servers/', parameters('sqlServerName'))]"
],
"properties": {
"startIpAddress": "0.0.0.0",
"endIpAddress": "255.255.255.255"
}
},
{
"name": "[parameters('databaseName')]",
"type": "databases",
"location": "[resourceGroup().location]",
"apiVersion": "2014-04-01-preview",
"kind": "v12.0",
"dependsOn": [
"[parameters('sqlServerName')]"
],
"tags": {
"displayName": "SqlDatabase"
},
"properties": {
"collation": "[parameters('sqlDatabaseUriNameCollation')]",
"edition": "[parameters('sqlDatabaseUriNameEdition')]",
"maxSizeBytes": "10737418240"
//10 gigs currently
}
}
]
}
Also as #Robert McKee pointed make sure you have latest Azure SDK (2.7.1 or 2.8 released recently)
I'm not sure how, but this evening when I went to try it again, it worked. Thank you all for your answers!
When i run on local. Everything is going okay.
But my appication is not running on cloud provide url
https://<your-project-id>.appspot.com
But working Great on locally.
When first time i deploy its work for me https://<your-project-id>.appspot.com but when i add class and apply add, delete, edit operation its not work on https://<your-project-id>.appspot.com but still working on local.
After deploy
"response": {
"betaSettings": {
"has_docker_image": "True"
},
"name": "apps/trial-project-1103/modules/default/versions/20151021t211200",
"handlers": [
{
"securityLevel": "SECURE_NEVER",
"authFailAction": "AUTH_FAIL_ACTION_REDIRECT",
"urlRegex": ".*",
"login": "LOGIN_OPTIONAL",
"script": {
"scriptPath": "PLACEHOLDER"
}
}
],
"manualScaling": {
"instances": 1
},
"vm": true,
"#type": "type.googleapis.com/google.appengine.v1beta4.Version",
"runtime": "custom",
"id": "20151021t211200",
"resources": {
"diskGb": 10,
"cpu": 0.5,
"memoryGb": 1.2999999523162842
},
"threadsafe": true
},
"done": true,
"name": "apps/trial-project-1103/operations/e302b28c-6984-4362-a823-891f8806e10d",
"metadata": {
"target": "apps/trial-project-1103/modules/default/versions/20151021t211200",
"insertTime": "2015-10-21T16:14:55.935Z",
"method": "google.appengine.v1beta4.Versions.CreateVersion",
"user": "sajjadmurtaza.nxb#gmail.com",
"operationType": "create_version",
"endTime": "2015-10-21T16:17:44.649Z",
"#type": "type.googleapis.com/google.appengine.v1beta4.OperationMetadata"
}
}
Please guide me why this is happening.?
It's impossible to answer your first question without knowing a lot more about your app.
To answer your second, logs are found in the Google Cloud Platform Developers Console. Select your project, then navigate to Monitoring > Logs. You'll be able to see all of the logs for your project.
Have you successfully followed this tutorial?
https://cloud.google.com/ruby/getting-started/hello-world
if you can't ssh into the machine & see the production.log. then, you can enable logging by adding the following to config/environments/production.rb & deploy again
config.consider_all_requests_local = true
This will show the error in the browser itself
Be sure that you've enabled Datastore API in the Developer Console. Also, double check your Project ID and your Dataset ID (which should be the same as the project ID).
In my experience, these are the most common reasons for this error.