Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown insert tags and flags are not logged (in the backend log) #1182

Closed
agoat opened this issue Nov 13, 2017 · 9 comments
Closed

Unknown insert tags and flags are not logged (in the backend log) #1182

agoat opened this issue Nov 13, 2017 · 9 comments
Assignees
Labels
Milestone

Comments

@agoat
Copy link
Contributor

agoat commented Nov 13, 2017

Unknown insert tag and flags (e.g. {{non::sense|logme}}) will return an empty string and should be logged. In the InsertTags class on line 964 and 1058 the monolog.logger.contao service as called but nothing is shown in the log.

It looks like it's a problem in the monolog.logger.contao service. I haven't searched in the logger service for a bug yet, just found this problem when using the decodeEntity flag which is not correctly handled.

@fritzmg
Copy link
Contributor

fritzmg commented Nov 13, 2017

This kind of logging goes into var/logs. I am assuming this is intentional.

@agoat
Copy link
Contributor Author

agoat commented Nov 13, 2017

This kind of logging goes into var/logs

I didn't found an entry in my log file in the first try (because it's full of debugging info like 'Matched route "_wdt"...'). But you are right.

An unknown insert tag is logged in the var/logs file(s).

But does it make sense? A normal editor will never (be able to) look into these log files. I also expected an entry in the backend log first.

@agoat agoat changed the title Unknown insert tags and flags are not logged (monolog logger problem) Unknown insert tags and flags are not logged (in the backend log) Nov 13, 2017
@aschempp
Copy link
Member

Does it not log in the back end either?

@fritzmg
Copy link
Contributor

fritzmg commented Nov 14, 2017

In order for it to be logged to the back end the following context needs to be added:

array('contao' => new ContaoContext($strFunction, $strCategory))

(see System.php#L247-L265), which InsertTags::doReplace currently does not do. It is only logged to var/logs.

@leofeyer
Copy link
Member

It is not supposed to be logged in the back end IMO.

@leofeyer
Copy link
Member

@contao/developers Where do we want to log unknown insert tags and unknown insert tag flags? In var/logs or in tl_log?

@aschempp
Copy link
Member

I think it's a content management mistake so tl_log seems right to me.

@bytehead
Copy link
Member

bytehead commented Apr 11, 2018

👍 tl_log

@leofeyer leofeyer added this to the 4.4.18 milestone Apr 13, 2018
@leofeyer leofeyer self-assigned this Apr 16, 2018
@leofeyer
Copy link
Member

Changed in 1737ce0.

@leofeyer leofeyer modified the milestones: 4.4.18, 4.4 May 14, 2019
leofeyer pushed a commit that referenced this issue Mar 13, 2020
Description
-----------

This PR adds an option to clear the model registry.

This would be useful for functional tests that access Contao Mondels for instance. Here clearing the registry after each test class is essential for the isolation of test cases. Currently this can only be done by calling refresh on each model instance (which is unpractical) or by using reflection to access the registry's fields (which is hacky).

Commits
-------

7dd117a6 allow clearing the model registry
b8ef6dc6 rename method to reset
38000c70 add note about internal usage
0ff32c4b call reset on various legacy classes during kernel.reset
e27079a4 harden array access if key does not exist
6ce4363c test if reset calls are delegated
55985b6d Update core-bundle/src/Resources/contao/library/Contao/Model/Registry.php

Co-Authored-By: Leo Feyer <github@contao.org>
8f5fff7b fix unit-tests on ci
00f33f54 use page model
3f1a6828 CS
leofeyer pushed a commit that referenced this issue Jul 21, 2020
Description
-----------

This PR implements several long-discussed improvements we want to have in the Contao routing.

### Features:
- [x] Configure URL-prefix (`.html`) per root page instead of the app config
- [x] Configure the _prepend locale_ setting per root page instead of the app config
- [x] Implement support for custom language prefix (closes contao/contao#862)
- [x] Only redirect to the language version of a page if it exists (see contao/contao#1456)
- [x] Generate routes for entities (e.g. pass `PageModel` to `$router->generate()` (see contao/contao#831)
- [x] Allow for custom page types as controllers (see contao/contao#1160, contao/contao#390)
- [x] Allow a page type to have a static URL suffix (e.g. `.xml` instead of `.html` for the XML sitemap).

#### Side Features

 - [ ] ~Do not generate frontend URLs for pages with parameters~
- [ ] ~add alternative to the `Input` class that also tracks unused parameters~ (not sure about this, as the Input is no longer used with routing parameters)
- [x] _really_ only create template article for new pages that can have them
- [x] do not create article if the new page's layout does not have articles

### Tasks
- [ ] write documentation about _legacy routing mode_.
- [ ] include support for extended languages (see https://github.com/contao/core-bundle/issues/1579)
- [x] the url prefix should be unique for pages with the same dns setting. contao/contao#1516 (comment)

### Follow-Up PRs

- [x] Use router to generate SERP widget URL aschempp/contao#3
- [ ] Replace current page types aschempp/contao#4
- [ ] Support news aschempp/contao#5
- [ ] Support calendar events aschempp/contao#6
- [ ] Support other content (faq, etc.)

### Notes about backwards compatibility

As discussed at the developer meeting in February 2020, we cannot keep full BC between the new features and the existing routing. The `contao.prepend_locale` and `contao.url_suffix` container configuration as well as the `getPageIdFromUrl` or `getRootPageFromUrl` hooks are conflicting with the new features. We agreed that Contao should fall into a _legacy routing_ mode, where the new features are not available in the root page in that case.

**BC Todos:**
- [x] Disable root page configuration in legacy routing mode
- [x] ~Find a way to keep supporting `contao.routing.url_generator` service~ _only in legacy mode_ 


### Related PRs / Dependencies:
- [x] contao/contao#1447
- [x] contao/contao#1448
- [x] contao/contao#1458
- [x] contao/contao#1501
- [x] contao/contao#1503
- [x] contao/contao#1506
- [x] #1518
- [x] #1533
- [x] #1182 
- [x] ~~contao/contao#1639
- [x] contao/contao#1640
- [x] contao/contao#1650
- [x] contao/contao#1652
- [x] contao/contao#1864
- [x] contao/contao#1869
- [x] contao/contao#1896

Commits
-------

21a9efee Use page language instead of _locale parameter for $_GET['language']
c2ba2d18 Add languagePrefix and urlSuffix fields to tl_page
d3abce32 Deprecate the bundle config but override the page config if set
78dfc423 Fix alias rendering in PageTree
b8616b07 Rewrite the language filter to use the page properties
ec3969d4 Add legacy routing check to ContaoFramework class
4f26e730 Added separate class to generate URL candidates
29bd1112 Add languagePrefix and urlSuffix to PageModel with BC layer
510da353 Update RouteProvider to use candidates based on root page
02eca555 Add redirect routes if page is requested without languagePrefix
62f36562 Update routing functional tests
c1f2f93b Added migration for tl_page fields
39d987b6 Set config values from current request
5b03a6cf Correctly generate root and fallback routes with languagePrefix
db9768f4 Check for ID/alias duplicate with new page parameters
83fc2890 Use pageModel from request or trigger exception in deprecated methods without legacy mode
01b9c97b Update Route404Provider to use languagePrefix from PageModel
0d3f58bf Fixed service arguments for LegacyRoutingListener
bc029251 Added duplicates validation for alias, languagePrefix and urlSuffix
95c7042a Correctly migrate the legacy routing configuration
192fff16 CS and test fixes
aa09e969 Switch page type and alias field position
11638acb Add route name and object to the attributes
139b19c3 Add custom route object for PageModel
223182e2 Content resolvers convert content to a route object
168c2182 Let the page model tell if useAutoItem is enabled
8158ad24 Use service tagging to add router enhancers
bda2a160 CS
44a5a433 Let the router generate page URLs
b7bd00bc Use the DynamicRouter from CMF Routing Bundle
a8dcc223 Rename the ContentResolverInterface to ContentUrlResolverInterface
692742d8 Introducing page providers
190a38b1 Make PageRoute more flexible
53758600 Always render regular page for unknown types
4a27948d Added autoconfiguration for contao.page_provider
1b3bf760 Added RootPageProvider which provides the default url suffixes
0e559fc9 Generate page type options from providers
c03f5037 Added ContentCompositionListener to correctly show or hide article features
8b27f64d Added BC layer for UrlGenerator and other legacy routing
2c0115f0 Enable legacy routing by container configuration and throw exception if hooks require it
a9f09bca Add legacy routing information to the data collector
156ef523 Trigger deprecation warnings if the Symfony routing is not used
928de089 Always show list of legacy routing hooks in profiler
079370f9 Rename languagePrefix to urlPrefix
a0153401 Include the previous exception on re-throw
ca7ea33d Fix spelling in method name
f384d55c Use ::class in exception message
1fc7bfd6 ContentUrlResolvers must always return a route
f9cfbe88 Decorate the Candidates to implement legacy behavior
dea83bef Add an additional router for the legacy routes in legacy mode
41ab6c65 Adjust routing to string route name

see symfony-cmf/Routing#250
1d7968c1 Fix remaining objects passed to Router::generate()
10b1b3e3 Add some deprecation notices and annotations
815e1c07 Fixed argument order in exception message
8fdbdf95 Use anonymous services for legacy routing
ba676339 Merge remote-tracking branch 'upstream/master' into feature/routing

# Conflicts:
#	core-bundle/src/Framework/ContaoFramework.php
#	core-bundle/src/Resources/config/services.yml
#	core-bundle/src/Resources/contao/dca/tl_article.php
#	core-bundle/src/Resources/contao/dca/tl_page.php
#	core-bundle/src/Resources/contao/library/Contao/Template.php
#	core-bundle/src/Resources/contao/themes/flexible/main.min.css
#	core-bundle/tests/Routing/Enhancer/InputEnhancerTest.php
#	core-bundle/tests/Routing/Route404ProviderTest.php
50ba4cd8 Fix incorrect service name
fc680b74 Fix unit tests for ContaoCoreExtension
534ccdd9 Fix some tests
e0118c44 The contao.routing.url_generator is only available in legacy mode
f6f1d198 Fix remaining unit tests
87c121ac CS
f7ae7a9e Trigger route error only when used
6ba5f7a1 Added 100% test coverage for ContentCompositionListener
74f8c7c5 Added missing unit tests
22394dda Merge remote-tracking branch 'upstream/master' into feature/routing

# Conflicts:
#	core-bundle/src/Resources/contao/dca/tl_page.php
#	core-bundle/tests/DependencyInjection/ContaoCoreExtensionTest.php
#	core-bundle/tests/Functional/RoutingTest.php
325b1147 Fixed ContaoCoreExtensionTest
5627ec33 CS
888ec702 Merge remote-tracking branch 'upstream/master' into feature/routing

# Conflicts:
#	core-bundle/tests/Asset/ContaoContextTest.php
701cd593 CS
0be72326 Always insert the new article into an available layout column
cbd42acc Expect deprecations
afc706a1 CS
577f1fa3 CS
c719b1c5 CS
e51d4324 Move classes to new namespace
5b30edde Refactor with PageRouteFactory
edd253ef Added PageRegistry
de480f2f CS and tests
629300e4 Added concept of path parameters
bb76ae64 Fixed service name
793b3d56 Providing URL suffixes without custom routes does not make sense
4692bccd PageModel is not optional
502276ad Make the RouteFactory more generic
f11ab176 Merge remote-tracking branch 'upstream/master' into feature/routing

# Conflicts:
#	core-bundle/src/Framework/ContaoFramework.php
4dd724af Tests
62886460 Fixed failing test if there are no url suffixes
ae90ba66 Logger is optional
d696ed9d Logger is optional
0262068f phpstan
613c39ee phpstan
2afd655c phpstan & tests
37c4dda4 phpstan & tests
c337e1b0 phpstan & tests
5b78fa64 Merge remote-tracking branch 'upstream/master' into feature/routing
8342fa0b psalm & tests
edb1e52b yamllint
194f942a Do not use warning color if legacy routing is disabled
5a1b41a1 Reuse class name variable
c422a021 Register interfaces for autoconfiguration
c93b1e6d Drop unnecessary tags with autoconfigure
4328f77a Correctly purge search index
b5d4be1e Use PathUtil to check if hook is in vendor dir
ece1376c Throw correct exception if route is not supported
c60854cb Merge remote-tracking branch 'upstream/master' into feature/routing
f4ca10f7 Use the security voter to check article permissions
61bccf79 Tests
04f50f1e Tests
c4b004bb Rename page controllers
a806b39c Use subscribed services
289cc0ba URL must include prefix and suffix when generating candidates
2e507a45 CS
a63f3373 Rewrite candidates
d023ee3e Merge remote-tracking branch 'upstream/master' into feature/routing

# Conflicts:
#	core-bundle/src/Resources/contao/library/Contao/Controller.php
e46b79ad Fixed return type
82fbcc41 Code review
491c83b9 Code review
681dafdc Check if the URL prefix is duplicated in another root page
2fa6eee0 Merge remote-tracking branch 'upstream/master' into feature/routing
bfab096b Fix the coding style
c1cca71f Merge branch 'master' into feature/routing
f3cbd681 Fix the unit tests
63188d64 Fix the phpDoc types
92ea0725 Adjust the deprecation messages
35e4d71e Fix a non-optimal if condition
7ba51e75 Fix some minor issues
fba7c23a Adjust the "this setting has been disabled" warning
a1d05327 Review from @dmolineus
a972f8d8 Review from @leofeyer
164291bb Fixed Route404Provider tests
0dea19a8 Use permission constants
5c723859 Remove invalid model methods
444c7364 Use callback instead of listener method for help icon
6ef2654c Fix the coding style
d9a259ae Fix a wrong trans-unit ID
351c32fa Replace "@var Adapter" with something the IDE and PhpStan understand
ab6cb7eb Correctly generate the index route
b01b0598 Correctly match a request with url prefix if there is no index page
c089b6dd Merge remote-tracking branch 'upstream/master' into feature/routing

# Conflicts:
#	core-bundle/src/ContaoCoreBundle.php
#	core-bundle/src/Resources/contao/dca/tl_page.php
#	core-bundle/src/Resources/contao/models/PageModel.php
#	core-bundle/src/Routing/RouteProvider.php
#	core-bundle/tests/ContaoCoreBundleTest.php
c338e4a0 CS
7763b81d Fix the CI chain
5db0afe7 Drop the parameters field
a4aba627 Allow to define content composition in the service tag/annotation
31d34ec2 Get URL prefix and suffix from the page registry
ea8f57bd Rename the PageRouteEnhancerInterface
2e373e43 Update RootController, no longer needs additional interfaces
b8957447 Allow relative or absolute path for page controllers
3295ed80 CS
524c5e62 Fix tests
5850c246 CS
961ffcd4 Use $this->createResult() instead of new MigrationResult()
1f70bdbe Implemented feedback from @Toflar
ded7d5c2 Correctly validate the URL suffix
64b388e0 Correctly support absolute URLs with empty prefix
f7fda160 CS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants