Elixir OTP 24 doesn’t apply custom Logger backend - erlang

I have an umbrella application which has logger configuration in the root config.exs file:
config :logger,
compile_time_purge_level: :debug,
backends: [
{LoggerFileBackend, :backends_log}
]
config :logger, :backends_log,
path: "path/to/awesome.log",
level: :debug,
metadata: :all
After updating OTP from 22 to 24 version (elixir 1.12.3, erlang 24.1), backends_log is not starting and all logs are going to STDOUT with default :console backend. But configuration is still same:
Application.get_all_env(:kernel)
=> [
logger: [
{:handler, :default, :logger_std_h,
%{
config: %{type: :standard_io},
formatter: {:logger_formatter,
%{legacy_header: true, single_line: false}}
}}
],
logger_sasl_compatible: false,
logger_level: :notice,
shell_docs_ansi: :auto
]
Application.get_all_env(:logger)
=> [
handle_sasl_reports: true,
discard_threshold: 5000,
compile_time_purge_matching: [],
sync_threshold: 10000,
utc_log: false,
console: [],
backends_log: [path: "path/to/awesome.log", level: :debug, metadata: :all],
start_options: [],
pdu_format_reviewer_error_count: [level: :error],
compile_time_application: nil,
backends: [
{LoggerFileBackend, :backends_log}
],
discard_threshold_periodic_check: 30000,
translators: [
{Plug.Cowboy.Translator, :translate},
{Logger.Translator, :translate}
],
compile_time_purge_level: :debug,
truncate: 8096,
log_counter: [level: :debug],
handle_otp_reports: true,
discard_threshold_for_error_logger: 500,
translator_inspect_opts: []
]
:logger.get_primary_config()
=> %{
filter_default: :log,
filters: [process_disabled: {&Logger.Filter.process_disabled/2, []}],
level: :debug,
metadata: %{}
}
I can fix this problem with Runtime Configuration
Logger.add_backend({LoggerFileBackend, :backends_log})
Logger.configure_backend(
{LoggerFileBackend, :backends_log},
path: "path/to/awesome.log",
level: :debug,
metadata: :all
)
Logger.remove_backend(Logger.Backends.Console)
but I think Application Configuration is more proper way.
How should I fix this problem?

Your config works for me. My configuration is: Ubuntu2004, Elixir 1.12.2, Erlang 24.1 (ESL Erlang). I tried to recreate your problem. Take a look at it, it might help.
https://github.com/z5ottu/elixir_12_logger_test

Related

Typo3 Fatal error: Error\Exception: PHP Warning: gzuncompress()

I have updated my Typo3 ddev installation and i get this error:
Fatal error: Uncaught TYPO3\CMS\Core\Error\Exception: PHP Warning: gzuncompress(): data error in /var/www/html/public/typo3/sysext/core/Classes/Cache/Backend/Typo3DatabaseBackend.php line 158 in /var/www/html/public/typo3/sysext/core/Classes/Error/ErrorHandler.php:130 Stack trace: #0 [internal function]: TYPO3\CMS\Core\Error\ErrorHandler->handleError(2, 'gzuncompress():...', '/var/www/html/p...', 158, Array) #1 /var/www/html/public/typo3/sysext/core/Classes/Cache/Backend/Typo3DatabaseBackend.php(158): gzuncompress('a:1:{i:0;a:25:{...') #2 /var/www/html/public/typo3/sysext/core/Classes/Cache/Frontend/VariableFrontend.php(81): TYPO3\CMS\Core\Cache\Backend\Typo3DatabaseBackend->get('1__0_-99') #3 /var/www/html/public/typo3/sysext/core/Classes/Utility/RootlineUtility.php(211): TYPO3\CMS\Core\Cache\Frontend\VariableFrontend->get('1__0_-99') #4 /var/www/html/public/typo3/sysext/extbase/Classes/Configuration/BackendConfigurationManager.php(68): TYPO3\CMS\Core\Utility\RootlineUtility->get() #5 /var/www/html/public/typo3/sysext/ex in /var/www/html/public/typo3/sysext/core/Classes/Error/ErrorHandler.php on line 130
I don't understand what i'm missing.
I have did composer update, didn't solve it.
Even installtool say "no site configuration" "page are inaccessible"
Typo3 10.4
PHP 7
This may happen if you have utf8mb4 configured in TYPO3 configuration for the database but it is an old database with utf8 encoding.
Solution:
Dump the database
Drop the database
Create the database
Import the dump
You may want to check the dump that it does not force old utf8 encoding.
I've had a similar problem and truncating all cache tables on the database solved it for me.
I have find the solution, i was had a bad cache configuration in the localconf file, so i deleted all backend cache configuration:
[
'cacheConfigurations' => [
'hash' => [
'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend',
],
'imagesizes' => [
'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend',
'options' => [
'compression' => 1,
],
],
'pages' => [
'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend',
'options' => [
'compression' => 1,
],
],
'pagesection' => [
'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend',
'options' => [
'compression' => 1,
],
],
'rootline' => [
'backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend',
'options' => [
'compression' => 1,
],
],
],
],
So i guess that the caching method that i was using it wasn't working... maybe from my server side, i hope i find a solution for caching.

How to connect magento 2 to Redis

I have a magento 2 installation on docker, i would like to work with redis api, but not for magento2's session or page caching.
I would like to use the get() and set() commands to store strings, hash tables and many more.
Majorly what i need is a way to connect to a redis installed on docker instance that is on the same network as a magento 2 installation which is also on docker.
Thanks in advance.
I'm using Redis docker, maybe this will help you:
'session' => [
'save' => 'redis',
'redis' => [
'host' => 'redis',
'port' => '6379',
'password' => '',
'timeout' => '2.5',
'persistent_identifier' => '',
'database' => '0',
'compression_threshold' => '2048',
'compression_library' => 'gzip',
'log_level' => '1',
'max_concurrency' => '10',
'break_after_frontend' => '5',
'break_after_adminhtml' => '30',
'first_lifetime' => '600',
'bot_first_lifetime' => '60',
'bot_lifetime' => '7200',
'disable_locking' => '1',
'min_lifetime' => '60',
'max_lifetime' => '2592000'
]
],
'cache' => [
'frontend' => [
'default' => [
'backend' => 'Cm_Cache_Backend_Redis',
'backend_options' => [
'server' => 'redis',
'database' => '1',
'port' => '6379'
]
]
]
],
Regards

Rails Neo4j neo4j.config.session_path is deprecated, please use neo4j.config.session.path

I cannot understand this error neo4j.config.session_path is deprecated, please use neo4j.config.session.path. I get this in the myspec file during the testing. I updated Neo4j to version 9 from 7 and now I have this deprecation. I cannot understand what I should do because nowhere I cannot find the line is deprecated. I'm getting the error in the next lines of code:
describe "Edit Access" do
before :all do
Amendment.delete_all
a = Amendment.create(cid: "X1", namespace: "http://www.example.com", property: "question",
study_value: "ADEF", default_value: "A1", datatype: "string")
a = Amendment.create(cid: "X1", namespace: "http://www.example.com", property: "enabled",
study_value: "true", default_value: "true", datatype: "boolean")
a = Amendment.create(cid: "Y1", namespace: "http://www.example.com", property: "enabled",
study_value: "false", default_value: "true", datatype: "boolean")
ua_create
end
after :all do
Amendment.delete_all
ua_destroy
end
You should find neo4j.config.session_path defined somewhere in your app. Maybe search / grep for it? The places I would expect to find it are:
config/application.rb
config/environments/development.rb
config/environments/test.rb
config/environments/production.rb
Separately, I would make sure to read the upgrade guide for issues that may come up upgrading from 7.x to 8.x/9.x

Use Rails Logger with Savon gem

I have the following code:
def soap_client
soap_client = Savon.client(
wsdl: "https://api.five9.com/wsadmin/AdminWebService?wsdl&user=apiloader#daxko.com",
namespace: "http://service.admin.ws.five9.com/",
headers: {"Authorization" => "Basic #{#realm}"},
env_namespace: :soapenv,
namespace_identifier: :ser,
ssl_verify_mode: :none,
logger: Rails.logger,
log: true
)
end
This works and logs everything to my console window. However, it doesn't actually log anything to the Rails.logger...
How can I use the default Rails.logger with Savon?
EDIT
I am using savon (2.3.2).

Fail to integrate CKeditor in rails_admin gem (use gem rich)

I follow the link GitHub gem rich to install CKeditor to rails_admin
but I get the error: Unsupported field datatype: rich_editor
My model
edit do
field :title
field :description, :rich_editor do
config({
:insert_many => true
})
end
field :autho
field :book_type
end
How can I fix this error? Or that's an issue?
EDIT:
I tried it, and it worked
field :content, :text do
ckeditor do true end
end
I couldn't get the Rich gem to work with a Rails 4 project using Rails admin, so I decided to use the standard CK Editor Gem which is the recommended course of action by the authors. It took all of 5 minutes to get it working following this:
https://github.com/sferik/rails_admin/wiki/CKEditor
Then I configured my CK_Editor to use a small subset of the available functionality.
After adding the CK_Editor gem and configuring my rails admin initializer, I created a new javascript file in my project at:
/app/assets/javascripts/ckeditor/config.js
with the following contents:
CKEDITOR.config.toolbar = [
{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ],
items: [ 'Bold', 'Italic', 'Underline', 'Strike', '-', 'RemoveFormat' ] },
{ name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'bidi' ],
items: [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote',
'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] },
{ name: 'links', items: [ 'Link', 'Unlink' ] },
];
Remember to restart your Rails server!
I have the same issue. I think it is an issue in rails_admin or in rich. I have successfully integrate these two together in past (but with old versions of both).
I have created github issues for this in rich (https://github.com/bastiaanterhorst/rich/issues/80) and rails_admin (https://github.com/sferik/rails_admin/issues/1585) repos.

Resources