Symfony 4 + graylog + console errors - symfony

I have a web application and I need to write exceptions to graylog. I asked sysadmins and they told me to just throw exception messages to stdout and it will be enough, but this way doesn't work for me.
Meanwhile I have next door virtualhost with native PHP app which just have error_reporting = E_ALL and display_errors = 1 and these settings are enough, and graylog see these errors, but not mine (I'm using Symfony 4 + Monolog) in the Monolog config I have almost the default settings
main:
type: fingers_crossed
level: debug
path: 'php://stdout'
If I change path from stdout to logfilename it works ok, but I need to see my logs in graylog, not in a file. Unfortunately I haven't got the graylog configs, the Symfony application ones only.

Related

kong error using deck: cannot create or update 'services' entities when not using a database

I have set up kong in dbless mode on RHEL by following the below documentation
https://docs.konghq.com/gateway/latest/install-and-run/rhel/
Kong gateway is successfully started. Below are the configurations I added in kong.conf file where database is turned to off and path to declarative kong.yaml is specified
declarative_config = /temp/kong/kong.yml
database = off
Also, below is current .yaml file where I created a service using below link
https://docs.konghq.com/gateway/2.8.x/get-started/comprehensive/expose-services/
_format_version: "1.1"
services:
- host: mockbin.org
name: example_service
port: 80
protocol: http
routes:
- name: mocking
paths:
- /mock
strip_path: true
I have also installed deck to sync this the declarative configuration.
However, when I use the deck sync command to add this service to kong, I get below error
creating service example_service
Summary:
Created: 0
Updated: 0
Deleted: 0
Error: 1 errors occurred:
while processing event: {Create} service example_service failed: HTTP status 405 (message: "cannot create or update 'services' entities when not using a database")
Kindly need ideas on what could be wrong as I believe we can create a service in dbless mode, and I also think that this is the declarative format which should work. Looking forward to hear. Thanks
Kindly need ideas on what could be wrong as I believe we can create a service in dbless mode, and I also think that this is the declarative format which should work. Looking forward to hear. Thanks
You are correct that we can create a service in dbless mode, however the approach will be different.
If you already have the new config file in yaml format. you can load it to Kong using /config endpoint
I also think that decK should be process-agnostic and can be used with both db and dbless mode, But as it stands, loading yaml config file with /config endpoint looks like the best option.

Open files in PHPStorm with Vagrant+Symfony application

I know you can open files from Symfony profiler or exception file links using this in project/app/config.yml :
framework:
ide: "phpstorm://open?file=%%f&line=%%l"
More info: http://developer.happyr.com/open-files-in-phpstorm-from-you-symfony-application
However as I'm using vagrant, the file path of the server doesn't match my host.
I have created a PHP web application server in PHPStorm with the propper path mappings, but still doesn't work.
Any ideas?
Thanks
When running your app in a container or in a virtual machine, you can tell Symfony to map files from the guest to the host by changing their prefix. This map should be specified at the end of the URL template, using & and > as guest-to-host separators:
// /path/to/guest/.../file will be opened
// as /path/to/host/.../file on the host
// as /path/to/host/.../file on the host
'phpstorm://%f:%l&/path/to/guest/>/path/to/host/&/foo/>/bar/&...'
Symfony FrameworkBundle Configuration - IDE
The answer given by Jeffry no longer works unfortunately :(. When In configure that with my paths the profiler throws:
ParameterNotFoundException
You have requested a non-existent parameter "f:".
I have configured the path according to this line in the SF docs: This map should be specified at the end of the URL template, which results in this:
phpstorm://open?url=file://%%f&line=%%l&/path/to/guest/>/path/to/host/
However, it does open PHPStorm, but phpstorm does not open the file, so i'm a bit stuck here now.
This solves the issue with the file not opening in PhpStorm from a Vagrant:
phpstorm://open?file=%%f&line=%%l&/path/to/guest/>/path/to/host/
Source: https://youtrack.jetbrains.com/issue/IDEA-65879

SBT not passing credentials when publishing to Artifactory

I am coding a Java project and I'm automating the build and the publishing to JFrog Artifactory using SBT.
Whenever it's time to publish to Artifactory I want to do it using the Ivy directory layout and obviously publish the Ivy XML file along with the jar. I managed to achieve this by using the following lines in the build.sbt file:
crossPaths := false
publishTo := Some("Artifactory Realm" at "http://<Artifactory IP>:<Artifactory Port>/artifactory/org.project.my")
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
publishMavenStyle := false
However it only works when anonymous users are allowed to deploy into Artifactory. I realized that sbt is not really passing my credentials to Artifactory but, instead, logging in as anonymous.
My $HOME/.ivy2/.credentials file looks like this:
realm=Artifactory Realm
host=http://<Artifactory IP>:<Artifactory Port>/artifactory/org.project.my
user=<my user name>
password=<my user name>
However, if I change the Artifactory configuration in order to prevent anonymous users from deploying new Artifacts, when I run "sbt publish" I get the following output:
[error] Unable to find credentials for [Artifactory Realm # <Artifactory IP>].
java.io.IOException: Access to URL http://<Artifactory IP>:<Artifactory Port>/artifactory//org.project.my/org/project/my/project-my/1.0.0/project-my-1.0.0.jar was refused by the server: Unauthorized
The Artifactory request.log file then contains:
20160219011657|319|REQUEST|10.0.2.2|anonymous|PUT|/org.project.my/org/project/my/project-my/1.0.0/project-my-1.0.0.jar|HTTP/1.1|401|24978
I have also tried passing the credentials manually instead of using a file:
credentials += Credentials("Artifactory Realm", "localhost", "<USERNAME>", "<PASS>")
But I am getting the same result.
Any idea what I might be missing?
try:
host=<Artifactory IP>
old answer (doesn't work):
host=<Artifactory IP>:<Artifactory port>
I had a different problem: I had the wrong realm set on my .credentials file.
Looking at the error output from sbt, I was able to figure out that I should use:
realm=Artifactory Realm
Error shows the expected values for realm and host:
[error] Unable to find credentials for [Artifactory Realm # myhost].

PERIODICALLY Error: zend_mm_heap corrupted

Description: PERIODICALLY when adding a file through the API, the server crashes with the error in /var/log/httpd/error_log: zend_mm_heap corrupted.
This happens sometimes, then itself begins to work normally. Ie file is normally loaded, then it ceases to be loaded. Although at this time the other can be loaded normally.
I use API /api/providers/sonata.media.provider.file/media
The provider of the file system: sonata.media.filesystem.ftp
Development environment: no matter dev / prod
Composer:
sonata-project/media-bundle: "2.3.x-dev"
knplabs/gaufrette: >=0.1.4
apache+mod_php:
httpd-2.2.15-47.el6.centos.x86_64
httpd-itk-2.2.22-7.el6.x86_64
php55w-5.5.30-2.w6.x86_64
Other:
zend.enable_gc = Off
opcache.fast_shutdown = Off
USE_ZEND_ALLOC = 0
Issue: https://github.com/sonata-project/SonataMediaBundle/issues/866
Same issues with similar Symfony 3 with media bundle setup.
php_flag opcache.enable Off
Disabling opcache in .htaccess / php.ini solved the problem.

Symfony2.5 "cannot load resource after deploying on shared hosted server "

My code is working fine in localhost but when i deployed it on a "Shared Hosted Server"
then its giving following error:
Cannot load resource "#AcmeTestBundle/controller". Make sure the "AcmeTestBundle" bundle is correctly registered and loaded in the application kernel class.
on server i'm able to access config.php but when i tried to access app_dev.php or app.php
it shows the above error message
my routing is defined in "app/config/routing.yml" as
test:
resource: "#AcmeTestBundle/controller"
type: annotation
prefix: /
I cleared the cache also but nothing changed.
Am i missing something ???
Please Help me
Thanks in advance

Resources